[JAVA-151] Dot allowed in key names Created: 20/Aug/10 Updated: 20/Apr/20 Resolved: 23/Feb/11 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | 2.1 |
| Fix Version/s: | 2.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Tsz Ming Wong | Assignee: | Antoine Girbal |
| Resolution: | Done | Votes: | 2 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Description |
|
I can save a key with a "dot" using the latest Java client. This should not be allowed.
|
| Comments |
| Comment by Antoine Girbal [ 23/Feb/11 ] | |||||
|
fixed and added test | |||||
| Comment by auto [ 23/Feb/11 ] | |||||
|
Author: {u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}Message: | |||||
| Comment by Scott Hernandez (Inactive) [ 23/Feb/11 ] | |||||
|
Yep, sounds correct. | |||||
| Comment by Antoine Girbal [ 23/Feb/11 ] | |||||
|
looking into this, it seems that:
For example with update I can get: , "a.b" : 31} My understanding is that driver should apply check on update object, as long as first key does not start with "$". | |||||
| Comment by Scott Hernandez (Inactive) [ 11/Dec/10 ] | |||||
|
This patch should check for "$" as well. | |||||
| Comment by auto [ 09/Dec/10 ] | |||||
|
Author: {u'login': u'bwmcadams', u'name': u'Brendan W. McAdams', u'email': u'brendan@10gen.com'}Message: | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
huh, thats very interesting, thanks. I guess I'm very confused. | |||||
| Comment by Eliot Horowitz (Inactive) [ 23/Aug/10 ] | |||||
|
Not sure what you saw or are expecting... This behavior has always been there, certainly no changes since 1.4 | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
Ugh, yeah, good point. I guess I have to revert back to 1.4.. Any idea when this one will get fixed? | |||||
| Comment by Eliot Horowitz (Inactive) [ 23/Aug/10 ] | |||||
|
indexes for example, you often index on "person.state" and so need a key with a '.' If you try to insert an object with a dot in a field name, it will throw an exception | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
For us, dot's are never allowed in keys. Are there other places this will break? | |||||
| Comment by Eliot Horowitz (Inactive) [ 23/Aug/10 ] | |||||
|
That kind of fix won't work as dotted fields are valid in some places. save/insert will throw an exception in the right places. | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
big bug for us. Quick and nasty fix: Add to BasicDBObject.java @Override else { return super.put(key, val); }} | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
Oh no.. You're right. ack | |||||
| Comment by Eliot Horowitz (Inactive) [ 23/Aug/10 ] | |||||
|
@dustin - i think you're thinking of something else.
results in which is definitely a bug | |||||
| Comment by dustin norlander [ 23/Aug/10 ] | |||||
|
eee gad! this cannot be a bug.. doc.put("name.first", "First Name"); should result in : } This is the expected result, and works fine in 2.1. PLEASE do not require us to do: doc.put("name" , new BasicDBObject("first", "First Name")); I will need to rewrite large portions of my app, and it makes the code much, much, much uglier. |