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

fields not going away on a save() instead just going to null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.3.2
    • Component/s: JavaScript
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      t = db.b
      t.remove()
      t.insert(

      {x:102}

      )
      x = t.findOne()
      x.pack =
      "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      t.save
      t.find()
      printjson
      delete x.pack
      printjson
      t.save
      x = t.findOne()
      printjson
      t.find()

      Show
      t = db.b t.remove() t.insert( {x:102} ) x = t.findOne() x.pack = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" t.save t.find() printjson delete x.pack printjson t.save x = t.findOne() printjson t.find()

      Description

      This is peculiar:

      ~/main $ ./mongo
      MongoDB shell version: 2.3.1-pre-
      connecting to: test
      > t = db.b
      test.b
      > t.insert({x:102})
      > x = t.findOne()
      { "_id" : ObjectId("50dc0ce9f5c263c5c9f56781"), "x" : 102 }
      > x.pack = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      > 
      > t.save(x)
      > 
      > t.find()
      { "_id" : ObjectId("50dc0ce9f5c263c5c9f56781"), "x" : 102, "pack" : "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }
      > 
      > x
      {
      	"_id" : ObjectId("50dc0ce9f5c263c5c9f56781"),
      	"x" : 102,
      	"pack" : "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      }
      > delete x.pack
      true
      > 
      > x
      { "_id" : ObjectId("50dc0ce9f5c263c5c9f56781"), "x" : 102 }
      > 
      > t.save(x)
      > 
      > t.find()
      { "_id" : ObjectId("50dc0ce9f5c263c5c9f56781"), "x" : 102, "pack" : null }
      > 

      as one would expect the field pack to have completely gone away.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dwight_10gen Dwight Merriman
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: