2017-02-23 8 views
3

をMongoDBを更新した後、私はwinston-mongodbの最新バージョンをインストールしました。私はwinston-mongodbパッケージからmongodbのバージョンが1.6.6バージョンから2.0.7バージョンに更新していることに気付きました。更新後、私は得たこのwarning警告依存

サーバー/オプションが廃止されreplset/mongos、 は、オプションのトップレベルでサポートされているすべてのオプションは、オブジェクト [プールサイズ、SSL、sslValidate、SSLCA、のsslcert、sslKey 、sslPass、autoReconnect、noDelay、keepAlive、connectTimeoutMS、socketTimeoutMS、reconnectTries、reconnectInterval、ha、haInterval、replicaSet、secondaryAcceptableLatencyMS、acceptableLatencyMS、connectWithNoPrimary、authSource、w、wtimeout、j、forceServerObjectId、serializeFunctions、ignoreUndefined、raw、promoteLongs、bufferMaxEntries、readPreference 、pkFactory、promiseLibrary、readConcern、maxStalenessSeconds、loggerLevel、ロガー、promoteValues、promoteBuffers、promoteLongs、domainsEnabled、keepAliveInitialDelay、checkServerIdentity、validateOptions]

どのように私はこの問題を解決することができますか?何か案が?

答えて

0

私もこれに気づきました。
この問題は解決されているため、致命的ではないバグです。参照:https://jira.mongodb.org/browse/NODE-941。 私は次のようにテストしました: [email protected] - あなたが警告を報告した通りに!!! [email protected] - エラーが発生しました。 [email protected] - 警告なしと正常に動作します....

だから私は、今のところ2.2.22 versonインストールし、それが与え見ることをお勧めします。それは私がしたことです。私は警告を見たくないからです。
こちらがお役に立てば幸いです。エラーメッセージに従って

1

the server/replset/mongos options are deprecated, all their options are supported at the top level of the options object

ので、問題の解決策は、単にオブジェクトのトップレベルにまでサーバ、replset、socketOptions、mongos及び他階層オプションから設定オプションを移動しています。

mongoose.connect('mongodb://localhost/db', 
    { 
    useMongoClient: true, 
    server: { 
      ssl: true, 
      socketOptions: { 
       keepAlive: 300000, 
       connectTimeoutMS: 30000 
      }, 
      auto_reconnect: true, 
      reconnectTries: 300000, 
      reconnectInterval: 5000 
     }, 
    promiseLibrary: global.Promise 
    } 
); 

change it to; 

mongoose.connect('mongodb://localhost/db', 
    { 
    useMongoClient: true, 
    poolSize: 2, 
    ssl: true, 
    keepAlive: 300000, 
    connectTimeoutMS: 30000, 
    autoReconnect: true, 
    reconnectTries: 300000, 
    reconnectInterval: 5000, 
    useMongoClient: true, 
    promiseLibrary: global.Promise 
    } 
); 

希望します。 ありがとう、