[SERVER-21621] Piped query Created: 23/Nov/15  Updated: 23/Nov/15  Resolved: 23/Nov/15

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

Type: Improvement Priority: Major - P3
Reporter: Yang 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   

It would be great if collection.find() can support piped query like aggregation.

Let me explain this in a scenario below.

In a customer support team, if a customer's issue has been handled by an engineer before, it's desired that the same engineer should handle new issue raised by this customer.

Currently, to achieve this, I'd have to do two queries:
1. For a given engineer's ID, find customers he has supported before.
2. Find new issues raised by customers found in query 1.

This is technically possible but have drawbacks:
1. Two DB queries have to be done, instead of one.
2. Customer information isn't really required by application but it has to be transmitted over network back and forth.
3. If there're too many customers returned by query one, passing them back to MongoDB as parameter can potentially crash MongoDB.

If a piped query is supported, then customer information can be produced and consumed within MongoDB internally. It should be more optimal in term of performance and client side coding.



 Comments   
Comment by Ramon Fernandez Marina [ 23/Nov/15 ]

xuguoming@nexlabs.com, please take a look at the $lookup operator, for I think it provides the functionality you're looking for.

Regards,
Ramón.

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