Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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). 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)?

like image 488
Oleg Avatar asked Aug 28 '26 21:08

Oleg


1 Answers

The PHP driver gives you access to the individual write concern options.

For your case it would be:

$collection->remove(
    array('_id' => array('$in' => $idsToDelete)), 
    array("w" => 1, "j" => true));
like image 159
JohnnyHK Avatar answered Aug 30 '26 10:08

JohnnyHK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!