[DOCS-1340] Update#save docs should show the corresponding update being done. Created: 04/Apr/13  Updated: 03/Nov/17  Resolved: 05/Apr/13

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Scott Hernandez (Inactive) Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

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


Participants:
Days since reply: 10 years, 45 weeks, 5 days ago

 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);
}



 Comments   
Comment by auto [ 05/Apr/13 ]

Author:

{u'date': u'2013-04-05T19:51:58Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1340: updating update/save document
Branch: master
https://github.com/mongodb/docs/commit/694854ae2331cc761fa8ff8c972d9e5d2e570aed

Comment by auto [ 05/Apr/13 ]

Author:

{u'date': u'2013-04-05T19:51:58Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1340: updating update/save document
Branch: v2.2
https://github.com/mongodb/docs/commit/f317a6bf1cb7092e0baeb48146416d6d91e54e44

Generated at Thu Feb 08 07:40:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.