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

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

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.3.2
    • Affects Version/s: 2.2.2
    • Component/s: JavaScript
    • None
    • Fully Compatible
    • ALL
    • 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()

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            dwight@mongodb.com Dwight Merriman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: