[SERVER-3730] Illegal key names allowed in $set command Created: 31/Aug/11  Updated: 11/Jul/16  Resolved: 21/Sep/11

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 1.8.2, 2.0.0-rc0
Fix Version/s: 2.1.0

Type: Bug Priority: Major - P3
Reporter: Alvin Richards (Inactive) Assignee: Tony Hannan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-3494 syncThread: 10154 Modifiers and non-m... Closed
Related
related to SERVER-1991 error message for '.' in key name is ... Closed
Operating System: ALL
Participants:

 Description   

See also SERVER-1991 and FREE-2519

Problem:

The following statement is allowed

> db.test.insert(

{"x":1}

)
> db.test.update(

{"x":1}

, {$set:{$set:1}})
> db.test.find()

{ "$set" : 1, "_id" : ObjectId("4e5e10a88c7696dbcdd6a153"), "x" : 1 }

Per the naming rules

http://www.mongodb.org/display/DOCS/Legal+Key+Names

... a $ field name is illegal.

Reproduce:
See above

Workaround:
None



 Comments   
Comment by Tony Hannan [ 21/Sep/11 ]

Commit comment above was supposed to say "Disallow $-fields in modifier ops"

Comment by auto [ 21/Sep/11 ]

Author:

{u'login': u'TonyGen', u'name': u'Tony Hannan', u'email': u'tony@10gen.com'}

Message: SERVER-3730: Disallow himBHfields in modifier ops
Branch: master
https://github.com/mongodb/mongo/commit/55351e6fc80e2640ffd5ae0f397b7a96e4418659

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