Description
> db.test.insert({"_id" : 123456, "$push" : "foo"})
|
Tue Sep 25 08:53:46 uncaught exception: field names cannot start with $ [$push]
|
> db.test.insert({"_id" : 123456})
|
> db.test.find()
|
{ "_id" : 123456 }
|
> db.test.update({"_id" : 123456}, {"$set" : { "$push" : "foo" }})
|
> db.test.find()
|
{ "$push" : "foo", "_id" : 123456 }
|
> db.test.update({}, {"$rename" : {"$push" : "$"}})
|
> db.test.find()
|
{ "$" : "foo", "_id" : 123456 }
|
> db.test.update({}, {"$rename" : "$" : "$$$"}})
|
> db.test.find()
|
{ "$$$" : "foo", "_id" : 123456 }
|
It seems like the same field name validation rules should be enforced on updates for any modifiers.
Attachments
Issue Links
- is depended on by
-
SERVER-6833 Secondary crashes when replicating a document that the primary accepted (with a field name containing a "$")
-
- Closed
-
- is related to
-
SERVER-6399 Refactor update() code
-
- Closed
-
- related to
-
SERVER-14244 Additional tests for setting fields with $ names
-
- Closed
-