[DOCS-2345] Point out the two uses of update earlier in the docs Created: 04/Dec/13  Updated: 11/Jan/17  Resolved: 23/Jan/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Task Priority: Major - P3
Reporter: Joanna Cheng Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 10 years, 4 weeks ago

 Description   

http://docs.mongodb.org/manual/reference/method/db.collection.update/

Most people from an SQL background expect only the stated fields to be updated e.g.

db.foo.update({_id: ObjectId(...)}, {a:1, b:1})

would only modify fields a and b and leave the rest untouched.

Suggest rewording the introduction to

Modifies an existing document or documents in a collection. Can be used to either modify only specific fields, or to replace the document or documents entirely, depending on the update parameters passed.

I think we need the hint at two use-cases right at the start as it is a very common mistake to accidentally wipe out an entire document doing an update incorrectly.

(Users still may not read it and get into strife, but at least we tried)



 Comments   
Comment by Githook User [ 22/Jan/14 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-2110 DOCS-2345 tweaks to update method
Branch: v2.4
https://github.com/mongodb/docs/commit/3aa0c62baecd49c2b7d50459eae895010cc6feb0

Comment by Githook User [ 22/Jan/14 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-2110 DOCS-2345 tweaks to update method
Branch: master
https://github.com/mongodb/docs/commit/667a2513ddc8c9e885fb1bc721a680603b0268f7

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