diff --git a/reference/mongo/mongocollection/save.xml b/reference/mongo/mongocollection/save.xml index 167c3c24ec..aec3a2b23e 100644 --- a/reference/mongo/mongocollection/save.xml +++ b/reference/mongo/mongocollection/save.xml @@ -47,7 +47,27 @@ "safe" - Check that the save succeeded. + Can be a boolean or integer, defaults to &false;. If &false;, the + program continues executing without waiting for a database response. + If &true;, the program will wait for the database response and throw a + MongoCursorException if the insert did not + succeed. + + + 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). This overrides + the w variable set on the collection. + + + + + "fsync" + + + Boolean, defaults to &false;. Forces the insert to be synced to + disk before returning success. If &true;, a safe insert is implied + and will override setting safe to &false;. @@ -61,7 +81,9 @@ &reftitle.returnvalues; - Returns if the object was saved. + If safe was set, returns an array containing the status of the save. + Otherwise, returns a boolean representing if the array was not empty (an empty array will not + be inserted). @@ -71,6 +93,11 @@ Throws MongoCursorException if the "safe" option is set and the save fails. + + Throws MongoCursorTimeoutException if the "safe" + option is set to a value greater than one and the database cannot replicate + the operation in MongoCollection::$wtimeout milliseconds. + @@ -91,6 +118,13 @@ Added "options" parameter. + + 1.0.9 + + Added ability to pass integers to "safe" options (only accepted booleans + before) and added "fsync" option. + +