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

Full document replacement can change type of _id

    • 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

      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.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            benety.goh@mongodb.com Benety Goh
            Votes:
            0 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: