[SERVER-8037] fields not going away on a save() instead just going to null Created: 27/Dec/12  Updated: 11/Jul/16  Resolved: 27/Dec/12

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 2.2.2
Fix Version/s: 2.3.2

Type: Bug Priority: Minor - P4
Reporter: Dwight Merriman Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

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()

Participants:

 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.



 Comments   
Comment by Daniel Pasette (Inactive) [ 27/Dec/12 ]

This is a problem in the 2.2.2 version of the shell. It doesn't appear in the latest version of the 2.3.2-pre shell (0963605989b76bb98fcca08fd73774f818efb5cb)

Generated at Thu Feb 08 03:16:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.