Jul*_*029 7 mongoose mongodb node.js
在使用带选项server.ssl的mongoose 5.2.17连接到mongo后,如何消除此警告。
不建议使用server / replset / mongos / db选项,它们的所有选项在选项对象的最高级别[poolSize,ssl,sslValidate,sslCA,sslCert,sslKey,sslPass,sslCRL,autoReconnect,noDelay,keepAlive,keepAliveInitialDelay, connectTimeoutMS,家庭,socketTimeoutMS,reconnectTries,reconnectInterval,ha,haInterval,副本集,secondaryAcceptableLatencyMS,acceptableLatencyMS,connectWithNoPrimary,authSource,w,wtimeout,j,forceServerObjectId,serializeFunctions,ignoreUndefined,raw,bufferMaxEntries,Proscensness,Prostales,ProspectsScenery,Prostales,Prospects, loggerLevel,logger,promoteValues,promoteBuffers,promoteLongs,domainsEnabled,checkServerIdentity,validateOptions,appname,auth,user,password,authMechanism,压缩,fsync,readPreferenceTags,NumberOfRetries,auto_reconnect,minSize,monitorCommands,retryWrites,useNewUrl
它说,从移动的设置server,replset以及mongos按键成对象的顶层。
// The options inside the `server` attributes are moved to its parents.
// Same happens to `replset` and `mongos`
// Change this
mongoose.connect( 'mongodb://localhost/db',
{
useMongoClient: true,
server: {
poolSize: 2
},
promiseLibrary: global.Promise
}
);
// To this
mongoose.connect( 'mongodb://localhost/db',
{
useMongoClient: true,
poolSize: 2,
promiseLibrary: global.Promise
}
);
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅猫鼬文档中的选项。
| 归档时间: |
|
| 查看次数: |
1366 次 |
| 最近记录: |