[SERVER-1991] error message for '.' in key name is too vague in a $set command Created: 22/Oct/10  Updated: 06/Dec/22  Resolved: 13/Oct/17

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Drew Perttula Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

1.6.3 / 64bit


Issue Links:
Related
related to SERVER-7557 Update doesn't support "$"s in the fi... Closed
related to SERVER-30575 Please add escaping convention for do... Backlog
is related to SERVER-3730 Illegal key names allowed in $set com... Closed
Assigned Teams:
Query
Backwards Compatibility: Fully Compatible
Participants:

 Description   

This is good:

> db.test.insert({"x.y":1})
Fri Oct 22 13:08:29 uncaught exception: can't have . in field names [x.y]

This was not good for a user to stumble on:

> db.test.insert({"x":1})  
> db.test.update({"x":1}, {"$set":{"y":{"z.z":1}}})
not okForStorage

I wish the $set error also explained the problem with the dot in the key name.



 Comments   
Comment by Nicholas Zolnierz [ 13/Oct/17 ]

This issue has gone away as the field name validation has been removed from the shell. This means that dotted fields are valid in inserts/updates when using the shell, however client drivers may prohibit such behavior. The desired behavior to allow escaping field names with special characters (".", "$", etc) is being tracked in SERVER-30575.

Comment by Scott Hernandez (Inactive) [ 21/Jan/14 ]

Slightly better for 2.6:

update({"_id":-200}, {$set:{y:{"x.y":1}}})
x.y is not valid for storage.

But we still need to cleanup storage (based on final validation) related error messages.

Generated at Thu Feb 08 02:58:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.