[DOCS-4250] $rename cannot rename fields that contain a dot Created: 28/Oct/14  Updated: 08/Dec/14  Resolved: 08/Dec/14

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: v1.3.15

Type: Bug Priority: Major - P3
Reporter: Andrew Ryder (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-10987 Disallow inserting documents with inv... Backlog
Participants:
Days since reply: 9 years, 10 weeks, 2 days ago

 Description   

This page:
http://docs.mongodb.org/manual/release-notes/2.6-compatibility/#updates-enforce-field-name-restrictions

The suggested solutions of using unset and/or rename commands to remove or rename fields that contain a dot does not work.

Because the original source name must be specified as a field name one will have trouble getting a driver to encode it correctly. Using a driver that permits ignoring this problem (eg. C# with "CheckElementNames = false") causes the server to interpret the string as a dotted path and hence the unset or rename does not find the field at all (and does nothing).

At this time I do not know the solution to this problem but the suggested solutions certainly do not seem to be possible.



 Comments   
Comment by Kay Kim (Inactive) [ 08/Dec/14 ]

no worries.

Comment by Andrew Ryder (Inactive) [ 08/Dec/14 ]

Hi Kay, you are right. In 2.4.12 it works. $unset can be used in this way on 2.4.12. Thanks for the correction.

Comment by Githook User [ 05/Dec/14 ]

Author:

{u'username': u'kay-kim', u'name': u'kay', u'email': u'kay.kim@10gen.com'}

Message: DOCS-4250 dotted name compatibility
Branch: master
https://github.com/mongodb/docs/commit/ac4132efc72ca6ca4840d825ab3532fe792cf213

Comment by Kay Kim (Inactive) [ 05/Dec/14 ]

Hey Andrew –
I was using version 2.4.12

 
> db.dotted.find()
{ "_id" : ObjectId("5481d13d67bddec29dce4008"), "bar.baz" : 1 }
>  db.dotted.update( {}, {  $unset: {"bar.baz": 1 }} )
> db.dotted.find()
{ "_id" : ObjectId("5481d13d67bddec29dce4008") }
 

Comment by Andrew Ryder (Inactive) [ 05/Dec/14 ]

Hi there, just had a look at the review. Please note that unset does not work either. Both unset and rename use the mechanism of specifying the field in dot-notation which causes the server to translate it as a path. This means that the server looks for the wrong thing and does not find it. Unfortunately, the only solution I know of is to replace the whole document.

Generated at Thu Feb 08 07:47:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.