[JAVA-722] Errors when DBRef's $id is Object instead of simple value Created: 06/Jan/13 Updated: 19/Mar/13 Resolved: 24/Jan/13 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 2.10.1 |
| Fix Version/s: | 2.11.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Oleksii Lomako | Assignee: | Trisha Gee |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
any mongod version |
||
| Description |
|
Mongo is able to store objects in _id field, for example: when i try to make a DBRef from another collection to this record it also works: )}); Same stuff in Java just doesn't work: ...and we got this: } , } as you can see - we've got additional field "$id" that is not in DB!!! |
| Comments |
| Comment by auto [ 24/Jan/13 ] |
|
Author: {u'date': u'2013-01-24T18:01:57Z', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}Message: Merge pull request #96 from mutyonok/master
|
| Comment by auto [ 24/Jan/13 ] |
|
Author: {u'date': u'2013-01-07T18:50:13Z', u'email': u'alexey.lomako@gmail.com', u'name': u'mutyonok'}Message: Fixed |
| Comment by Jeffrey Yemin [ 22/Jan/13 ] |
|
Just waiting for a response to comments on the pull request: https://github.com/mongodb/mongo-java-driver/pull/96 |
| Comment by Ben McCann [ 10/Jan/13 ] |
|
Thanks for finding this and creating a pull request. I've been bitten by this myself. |
| Comment by Jeffrey Yemin [ 10/Jan/13 ] |
|
I'm working on a few other things now, but don't worry, it will get in to |
| Comment by Oleksii Lomako [ 10/Jan/13 ] |
|
Hi Jeff, Did you have time to merge my pull request? |
| Comment by Jeffrey Yemin [ 06/Jan/13 ] |
|
A pull request would be much appreciated. Make sure you follow the guidelines in https://github.com/mongodb/mongo-java-driver/blob/master/CONTRIBUTING.md. Thanks. |
| Comment by Oleksii Lomako [ 06/Jan/13 ] |
|
I have a fix for this problem - so I can make a pull request on github and hope you can merge it and release it with the next verion of Mongo java driver as my current work really needs this fix Ofcourse I know that it is possible to workaround this issue by setting my own DBCallback, but I prefer to programm without any workarounds, especially when you can easilly fix this bug. Thanks in advance! |
| Comment by Oleksii Lomako [ 06/Jan/13 ] |
|
The problem is in DefaultDBCallback.java - this callback cannot handle compound Id in DBRef. It doesn't track names of objects when decodes them. It is very easy to fix the bug - DefaultDBCallback shoud have its own stack of decoded object names (like BasicBSONDecoder) instead of just tracking last decoded name in _lastName variable. |