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

upsert:true with a Dotted _id Query

    XMLWordPrintableJSON

Details

    Description

      https://docs.mongodb.com/manual/reference/method/db.collection.update/#mongodb30-upsert-id

      According to this document the upsert does not go through because

      "This restriction ensures that the order of fields embedded in the _id document is well-defined and not bound to the order specified in the query"

      But if I slighlty modify the query as below it inserts successfully
      Why is this allowed?

      db.collection.update( { "_id.name": "Robert Frost", "_id.uid": 0 },
         { "$set": { "categories": ["poet", "playwright"] } },
         { upsert: true } )
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            chaughulenaynishp@gmail.com Naynish Chaughule
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago