News for hackers. Stuff that matters.
Re:MongoDB 1.8 (stable) released by dmytton on Wednesday March 16, 2011 @06:36PM (#2334273)
Yes, if you combine journaling with safe write operations. This allows you to call the appropriate driver method to confirm that the data has been written. You can also wait for it to be written to n slaves in replication. I believe that "written" means either to the data files or the journal. In the case of the journal, a hard crash would result in the journal being replayed so that the data is then written to disk and you don't get corruption.

For example in the PHP driver, calling insert with the safe option. http://www.php.net/manual/en/mongocollection.insert.php

"If safe is an integer, will replicate the insert to that many machines before returning success (or throw an exception if the replication times out, see wtimeout)."

You can then immediately called http://www.php.net/manual/en/mongodb.lasterror.php to confirm the last operation didn't error.

There are no comments on this comment yet.