Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-4884

Document db.collection.update() behavior change from 2.6

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Done
    • None
    • None
    • manual
    • None
    • 4
    • Docs Sprint 16 - Ending 3/13

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

      Attachments

        Issue Links

          Activity

            People

              andrew.aldridge@mongodb.com Andrew Aldridge
              michael.grundy Michael Grundy
              Jess Mokrzecki Jess Mokrzecki
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8 years, 30 weeks, 5 days ago