2

Express.jsアプリのモジュールを使用していmongooseますが、アプリを起動するたびにこのエラーが発生し続けます。

========================================================================================
=  Please ensure that you set the default write concern for the database by setting    =
=   one of the options                                                                 =
=                                                                                      =
=     w: (value of > -1 or the string 'majority'), where < 1 means                     =
=        no write acknowlegement                                                       =
=     journal: true/false, wait for flush to journal before acknowlegement             =
=     fsync: true/false, wait for flush to file system before acknowlegement           =
=                                                                                      =
=  For backward compatibility safe is still supported and                              =
=   allows values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}]      =
=   the default value is false which means the driver receives does not                =
=   return the information of the success/error of the insert/update/remove            =
=                                                                                      =
=   ex: new Db(new Server('localhost', 27017), {safe:false})                           =
=                                                                                      =
=   http://www.mongodb.org/display/DOCS/getLastError+Command                           =
=                                                                                      =
=  The default of no acknowlegement will change in the very near future                =
=                                                                                      =
=  This message will disappear when the default safe is set on the driver Db           =
========================================================================================

書き込みの懸念を設定する方法がわかりません。私は次のようにデータベースに接続しています:

mongoose.connect('mongodb://localhost/reader')
4

2 に答える 2

4

あなたがしたいことは:

mongoose.connect('mongodb://localhost/reader', {db:{safe:false}})

これにより、mongoドライバーでこの明示的な書き込みに関する問題が発生する前に存在していたデフォルトの動作が得られます。

詳細はこちら: http: //mongoosejs.com/docs/api.html#index_Mongoose-createConnection

于 2013-03-15T01:57:39.887 に答える
3

connect-mongodbパッケージのせいでした。私はそれをに変更しました、connect-mongoそしてこれは問題を修正しました!

于 2013-02-19T11:34:13.533 に答える