You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
can't set property 'family' of options in MongooseModule.forRoot
console log when compile:
src/app.module.ts:24:58 - error TS2345: Argument of type '{ useNewUrlParser: boolean; useCreateIndex: boolean; useFindAndModify: boolean; autoIndex: boolean; reconnectTries: number; reconnectInterval: number; poolSize: number; bufferMaxEntries: number; connectTimeoutMS: number; socketTimeoutMS: number; family: number; }' is not assignable to parameter of type 'MongooseModuleOptions'.
Types of property 'family' are incompatible.
Type 'number' is not assignable to type '4 | 6'.
Minimal reproduction of the problem with instructions
my options:
const options = {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
autoIndex: false, // Don't build indexes
reconnectTries: Number.MAX_VALUE, // Never stop trying to reconnect
reconnectInterval: 500, // Reconnect every 500ms
poolSize: 10, // Maintain up to 10 socket connections
// If not connected, return errors immediately rather than waiting for reconnect
bufferMaxEntries: 0,
connectTimeoutMS: 10000, // Give up initial connection after 10 seconds
socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity
family: 4 // Use IPv4, skip trying IPv6
}
What is the motivation / use case for changing the behavior?
Environment
Nest version: 6.10.14
@types/mongoose: 5.7.0
For Tooling issues:
- Node version: 12.9.1
- Platform: Windows
Others:
The text was updated successfully, but these errors were encountered:
I found my mistake.I should call forRoot like this:
MongooseModule.forRoot(mongoDB, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
autoIndex: false, // Don't build indexes
reconnectTries: Number.MAX_VALUE, // Never stop trying to reconnect
reconnectInterval: 500, // Reconnect every 500ms
poolSize: 10, // Maintain up to 10 socket connections
// If not connected, return errors immediately rather than waiting for reconnect
bufferMaxEntries: 0,
connectTimeoutMS: 10000, // Give up initial connection after 10 seconds
socketTimeoutMS: 45000, // Close sockets after 45 seconds of inactivity
family: 4 // Use IPv4, skip trying IPv6
})
I'm submitting a...
Current behavior
can't set property 'family' of options in MongooseModule.forRoot
console log when compile:
src/app.module.ts:24:58 - error TS2345: Argument of type '{ useNewUrlParser: boolean; useCreateIndex: boolean; useFindAndModify: boolean; autoIndex: boolean; reconnectTries: number; reconnectInterval: number; poolSize: number; bufferMaxEntries: number; connectTimeoutMS: number; socketTimeoutMS: number; family: number; }' is not assignable to parameter of type 'MongooseModuleOptions'.
Types of property 'family' are incompatible.
Type 'number' is not assignable to type '4 | 6'.
24 imports: [BillsModule, MongooseModule.forRoot(mongoDB, options)],
Expected behavior
be able to set property 'family' to 4
Minimal reproduction of the problem with instructions
my options:
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: