Details
-
Improvement
-
Resolution: Duplicate
-
Major - P3
-
None
-
None
-
None
Description
please consider improving usage of find with fields parameter specified to handle DBRefs. This can be easy way to do joins automatically like this:
> db.foo.insert({a: 1});
|
> var a = db.foo.findOne(); |
> a
|
{ "_id" : ObjectId("4c67d3ae8d551a734559d73c"), "a" : 1 } |
> db.foo.insert({b:2, a: new DBRef("foo", a._id)}); |
> var b = db.foo.findOne({b:2}); |
> b
|
{
|
"_id" : ObjectId("4c67d3ee8d551a734559d73d"), |
"b" : 2, |
"a" : { |
"$ref" : "foo", |
"$id" : ObjectId("4c67d3ae8d551a734559d73c") |
}
|
}
|
improved find would be able to do this:
> var b = db.foo.findOne({b:2}, {b:1, "a.a": 1}); |
> b
|
{ "_id" : ObjectId("4c67d3ee8d551a734559d73d"), "b" : 2, "a" : { "_id" : ObjectId("4c67d3ae8d551a734559d73c"), "a" : 1} } |
Attachments
Issue Links
- duplicates
-
SERVER-19095 $lookup
-
- Closed
-
- is related to
-
SERVER-745 Embedded Document Expansion (Pseudo-JOINs)
-
- Closed
-
-
SERVER-432 server side expansion of DBRefs
-
- Closed
-