[SERVER-1632] improve find with using DBRef to support joins Created: 15/Aug/10  Updated: 24/Jun/15  Resolved: 24/Jun/15

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: igo Assignee: Unassigned
Resolution: Duplicate Votes: 6
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-19095 $lookup Closed
Related
is related to SERVER-745 Embedded Document Expansion (Pseudo-J... Closed
is related to SERVER-432 server side expansion of DBRefs Closed
Participants:

 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} }



 Comments   
Comment by Ian Whalen (Inactive) [ 24/Jun/15 ]

Hi Igo, thanks a lot for filing this feature request and my apologies for the time since it was last updated.

I'm going to close this as a Duplicate and link it to our upcoming $lookup feature - after careful consideration we’ve decided to provide users with the desired functionality via our aggregation pipeline instead of our regular query system.

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