我有關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:[email protected]:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true}, function(err, result)
但林不知道這是否是安全的:真正的連接,所以我把這樣的
var db = mongo.db("root:[email protected]:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{safe:true},{new:true}, function(err, result)
正是以這種方式是安全的:真正的,但是當我把安全:真之前新:真正的MongoDB返回我的老VAR,所以我把安全:真後新:真正
var db = mongo.db("root:[email protected]:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true},{safe:true}, function(err, result)
和工作的權利,但林不知道這是否是安全的:真實的,所以我儘量把安全:真新:真正的對象這樣
var db = mongo.db("root:[email protected]:27017/cordoba",{safe:true});
db.collection('usuarios').insert(campos,{new:true,safe:true},function(err, result)
我以爲那個星期一gdb嚇壞了!但沒有...沒有錯誤沒有什麼....所以我不知道我怎麼能知道當mongodb使用安全:真或不安全:真...
我怎麼知道?
好的,謝謝你,再次閱讀api文檔... – andrescabana86 2013-02-21 22:09:28