Details
-
Improvement
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
*Location*: http://docs.mongodb.org/manual/applications/update/
*User-Agent*: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.43 Safari/537.31
*Screen Resolution*: 1920 x 1200
*repo*: docs
*source*: applications/update
Description
http://docs.mongodb.org/manual/applications/update/#save
If there is an _id value, then it should show the update statement used (including the upsert flag). A logical code block like this is probably the easiest way for most to understand when skimming.
function save(doc){
|
if(doc["_id"])
|
update({_id:doc["_id"]}, doc, {upsert:true});
|
else
|
insert(doc);
|
}
|