简体   繁体   English

mongodb写关注

[英]mongodb write concern

As far as I can judge when I set for write "safe" = true, it sets options w = 1, j = 0, it confirms getting of write operation, but doesn't confirm writing to disk (durability). 我可以判断当我设置写入“safe”= true时,它设置选项w = 1,j = 0,它确认获取写操作,但不确认写入磁盘(持久性)。 Something like this: 像这样的东西:

$collection->remove(array('_id' => array('$in' => $idsToDelete)), array('safe' => true));   

Can I set w = 1, j = 1 to guarantee durability (not in the newest driver)? 我可以设置w = 1,j = 1以保证耐用性(不是最新的驱动程序)吗?

The PHP driver gives you access to the individual write concern options. PHP驱动程序使您可以访问各个写入关注选项。

For your case it would be: 对于你的情况,它将是:

$collection->remove(
    array('_id' => array('$in' => $idsToDelete)), 
    array("w" => 1, "j" => true));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM