mongodbでの接続について何度も質問しましたが、まだ多くのことを理解できませんが、試してみます...
この接続で...
db.collection('usuarios').insert(campos,{safe:true}, function(err, result)
私は安全な接続を取得します....しかしmongodbは私にこの警告を引き出します
========================================================================================
= Please ensure that you set the default safe variable to one of the =
= allowed values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}] =
= the default value is false which means the driver receives does =
= return the information of the success/error of the insert/update/remove =
= =
= ex: new Db(new Server('localhost', 27017), {safe:true}) =
= =
= http://www.mongodb.org/display/DOCS/getLastError+Command =
= =
= The default of false will change to true in the near future =
= =
= This message will disappear when the default safe is set on the driver Db =
========================================================================================
だから私はこの方法を試します...
var db = mongo.db("root:toor@127.0.0.1:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true}, function(err, result)
しかし、これが安全かどうかはわかりません:本当の接続なので、私はこのように置きます
var db = mongo.db("root:toor@127.0.0.1:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{safe:true},{new:true}, function(err, result)
その方法はsafe:trueかもしれませんが、new:trueの前にsafe:trueを置くと、mongodbは古い変数を返すので、new:trueの後にsafe:trueを置きます
var db = mongo.db("root:toor@127.0.0.1:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true},{safe:true}, function(err, result)
正しく動作しますが、safe:trueかどうかわからないので、このようなnew:trueオブジェクトにsafe:trueを入れてみます
var db = mongo.db("root:toor@127.0.0.1:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true,safe:true},function(err, result)
私はmongdbがおかしいと思った!しかし、何も...エラーも何も....だから、mongodbがsafe:trueまたはnot safe:trueを使用していることをどうやって知ることができるのかわかりません...
どうすればそれを知ることができますか?