Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-32934

Full document replacement can change type of _id

    XMLWordPrintableJSON

Details

    • Query Execution
    • ALL
    • v3.6
    • Hide

      > db.c.insert({_id: 1})
      WriteResult({ "nInserted" : 1 })
      > db.c.update({_id: 1}, {_id: NumberDecimal(1)})
      WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
      > db.c.find()
      { "_id" : NumberDecimal("1.00000000000000") }
      

      Show
      > db.c.insert({_id: 1}) WriteResult({ "nInserted" : 1 }) > db.c.update({_id: 1}, {_id: NumberDecimal(1)}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) > db.c.find() { "_id" : NumberDecimal("1.00000000000000") }
    • Query 2018-02-12, QO 2023-02-20

    Description

      Full document replacement can change the type of immutable fields in 3.6. It cannot change the value. Modifier-style updates cannot change the type.

      Attachments

        Issue Links

          Activity

            People

              backlog-query-execution Backlog - Query Execution
              benety.goh@mongodb.com Benety Goh
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: