DBRef is missing $ref, $id, $db attributes

Pedro Cardoso shared this problem 6 years ago
Solved

Hello,

this my script in NoSQLBooster. See the result


However, this script works in the mongoDB enironment shell. Any ideia?

e6f1d863de8b06a9baee43576eda6f15

Heres the print of dbREF

/923fbcecfe65a781c22fd322454a5579

Replies (2)

photo
1

Thank you for your bug report. We will fix the issue in the next build.

As a workaround solution, you can use DBRef.toJSON() to get "$ref","$id" and "$db" attributes.

var user=db.users.findOne({})
var dbRef=user.address.toJSON();
db[dbRef.$ref].find({"_id": dbRef.$id})

photo
1

Fixed in 5.0.3

Leave a Comment
 
Attach a file