[SERVER-11682] Aggregate on multiple collections Created: 13/Nov/13  Updated: 03/Feb/16  Resolved: 04/Nov/15

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

Type: New Feature Priority: Major - P3
Reporter: Vitaliy F. Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-19095 $lookup Closed
Participants:

 Description   

another way to implement cross-collections joins.
ex: 2 collections: Books and Authors.

 
book = { _id:1, title: 'A', author_id: 1 }
author = { _id: 1, name: 'Me' }
 
db.aggregate(
 {$collection: 'book', $match: ...},
 {$collection: 'author', $match: ...},
 ...
 {$group: ...},
 {$project: ...}
)

in result (example too):

books_with_authors = [
 {_id:1, title: 'A', author: { _id: 1, name: 'Me' }},
 ...
]



 Comments   
Comment by Charlie Swanson [ 04/Nov/15 ]

This appears to be a duplicate (at least in functionality) of the new $lookup stage (documentation here). I'm closing this as a duplicate, but if it does not match the desired functionality, please feel free to re-open.

Generated at Thu Feb 08 03:26:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.