[SERVER-10002] Possible to create docs with dotted field names Created: 24/Jun/13  Updated: 07/Mar/14  Resolved: 10/Sep/13

Status: Closed
Project: Core Server
Component/s: Internal Client, Write Ops
Affects Version/s: 2.5.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-10987 Disallow inserting documents with inv... Backlog
duplicates SERVER-10547 Do lightweight insert check (not deep... Closed
duplicates SERVER-10297 Strengthen checks in okForStorage to ... Closed
duplicates SERVER-10298 Apply okForStorage to object replacem... Closed
Operating System: ALL
Participants:

 Description   

conn.update("test.user", BSON("y" << 1), BSON("x" << BSON("a.b" << 1)), true);
conn.insert("test.user", BSON("x" << BSON("y.z" << 3)));

And end up with a field you cannot refer to on its own:

> db.user.find()
{ "_id" : ObjectId("51c85fc622cbaa0259719bca"), "x" : { "a.b" : 1 } }
{ "_id" : ObjectId("51c8627822cbaa0259719bcb"), "x" : { "y.z" : 3 } }
 
> db.user.find({ 'x.a.b': 1 })
> db.user.find({ x: { 'a.b': 1 }})
{ "_id" : ObjectId("51c85fc622cbaa0259719bca"), "x" : { "a.b" : 1 } }

Note: Currently, some drivers already have checks to prevent user from doing this (test on the mongo shell and Ruby driver). Might also want to consider adding the check on the server.


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