[SERVER-243] make dbref type use DBPointer and add new DBRef for js (WAS: DBRef in console doesn't work in .find() context.) Created: 19/Aug/09  Updated: 12/Jul/16  Resolved: 02/Oct/09

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 0.9.8, 0.9.9
Fix Version/s: 1.1.2

Type: Improvement Priority: Major - P3
Reporter: Phillip Oldham Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

> use test
switched to db test
> db.main.find()
{"_id" : "b45c046c-c502-11dd-b0b6-001d7dc91168" , "_ref" : {"$ref" : "test" , "$id" : "b44ab2b6-c502-11dd-b0b6-001d7dc91168"}}
> db.test.find()

{"_id" : "b44ab2b6-c502-11dd-b0b6-001d7dc91168"}

> db.main.find(

{"_ref": DBRef('test', 'b44ab2b6-c502-11dd-b0b6-001d7dc91168')}

)
Wed Aug 19 10:01:05 JS Error: Error: 2nd arg to DBRef needs to be oid (shell):0



 Comments   
Comment by Eliot Horowitz (Inactive) [ 16/Oct/09 ]

release 10/16/2009

Comment by Phillip Oldham [ 19/Aug/09 ]

Understood, but our other developer didn't know this and from the docs was trying DBRef from the console. Thought I'd add the error here for future reference/fix.

Comment by Eliot Horowitz (Inactive) [ 19/Aug/09 ]

DBRef in the shell is the old style DBRef right now.

For now, you can do:
db.main.find({"_ref":

{ $ref: 'test', $id :'b44ab2b6-c502-11dd-b0b6-001d7dc91168' }

} )

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