[SERVER-9677] $db values for DBRef datatype does not seem to persist in mongo collection Created: 14/May/13 Updated: 07/Mar/14 Resolved: 28/May/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage, Write Ops |
| Affects Version/s: | 2.4.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ravi Shakya | Assignee: | Stephen Lee |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | BSON, DBRef | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Ubuntu 10.04 on x86 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Operating System: | Linux | ||||||||
| Steps To Reproduce: | 1) Create a collection named 'people' in database 'kamal' and insert a doc as }) ) |
||||||||
| Participants: | |||||||||
| Description |
|
While storing a DBRef datatype with all the 3 values i.e. $ref, $id and $db values into a collection, $db does not seem to have been stored. |
| Comments |
| Comment by Jérôme Leleu [ 17/Jun/13 ] | ||||||||||||||||||||||
|
Hi, Any news for this ? | ||||||||||||||||||||||
| Comment by Stephen Lee [ 28/May/13 ] | ||||||||||||||||||||||
|
Ravi, I'm resolving this. Please upvote/watch | ||||||||||||||||||||||
| Comment by Ravi Shakya [ 24/May/13 ] | ||||||||||||||||||||||
|
Yeah Steven if you could create improvement ticket and if it's fixed, everyone will benefit I believe. | ||||||||||||||||||||||
| Comment by Stephen Lee [ 24/May/13 ] | ||||||||||||||||||||||
|
Ravi, Yes, I agree it's a little confusing that the string representation of the DBRef doesn't include the referenced database. However, it should be pretty clear that DBRef object does retain the referenced database. If you're interested, I can create an improvement ticket for you. -Stephen | ||||||||||||||||||||||
| Comment by Ravi Shakya [ 24/May/13 ] | ||||||||||||||||||||||
|
Hi Stephen, Thanks for checking and informing about the issue. Yeah I expected $db value to be present in BSON doc just like others i.e. $id and $ref. I wonder why it was not displayed on BSON when other 2 were. | ||||||||||||||||||||||
| Comment by Stephen Lee [ 23/May/13 ] | ||||||||||||||||||||||
|
Hi Ravi, Based on your screenshots, I suspect that you're expecting the database to appear in the BSON to string representation of the DBRef. However, upon inspection of the $db field of the objected stored in "myref" field, I do see the expected database name, "kamal".
As an aside, we generally recommend denormalizing your data such that you won't need references, but if you must "join" two collections, a manual reference might be more flexible. -Stephen |