[DOCS-4884] Document db.collection.update() behavior change from 2.6 Created: 26/Feb/15  Updated: 30/Oct/23  Resolved: 12/Mar/15

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

Type: Bug Priority: Critical - P2
Reporter: Michael Grundy Assignee: Andrew Aldridge
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-5167 Should not include dot notation examp... Closed
related to SERVER-17399 db.collection.update() upsert behavio... Closed
Participants:
Days since reply: 8 years, 48 weeks, 5 days ago

 Description   

in db.collection.update() we should call out that there is additional validation between the query and update objects, and that the paths must match if _id is specified in the update, and that dotted paths aren't acceptable in the query (e.g. _id.field)

Changed in SERVER-14973

Scott and Greg discussed this during the code review

Example:

> q={'_id.git_hash': 'e6577bc37'}
> u={'count': 49.97, '_id': {'hash': 'e6577bc37'}}
 
> db.coll_name.update(q,u,upsert=true)
 
WriteResult({
    "nMatched" : 0,
    "nUpserted" : 0,
    "nModified" : 0,
    "writeError" : {
        "code" : 111,
        "errmsg" : "field at '_id' must be exactly specified, field at sub-path '_id.build_id'found"
    }
})



 Comments   
Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'mpaik', u'name': u'Michael Paik', u'email': u'michael.paik@10gen.com'}

Message: DOCS-4884
Branch: master
https://github.com/mongodb/docs/commit/660960a863b11f48a90921e0b731ae5a1fdb9247

Comment by Githook User [ 13/Mar/15 ]

Author:

{u'username': u'i80and', u'name': u'Andrew Aldridge', u'email': u'i80and@foxquill.com'}

Message: DOCS-4884: Mention MongoDB 3.0 upsert changes
Branch: master
https://github.com/mongodb/docs/commit/00860578e380efe29e53987844dea49837716ba2

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