[SERVER-54860] Allow taking out elements from aggregation and include them in return Created: 01/Mar/21  Updated: 29/Mar/21  Resolved: 29/Mar/21

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

Type: Improvement Priority: Major - P3
Reporter: Johannes Jumpertz Assignee: Edwin Zhou
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

The idea would be to allow selecting documents in midst a pipeline, remove them from the current flow, but return them together with the rest of the pipeline output.

Example case:
You have two collections with a ManyToMany "relation". Collection 1 has a boolean field and a list of ids from collection 2. 
Now imagine you would like to get all documents from collection 1 where the boolean is true or some property in one of the "related" documents from collection 2 meets a specific condition.
Right now you would have to do a lookup for all documents (including those with the boolean set to true). This could turn to be a inneficient if a lot of the documents from collection one have the boolean set to true, because it will still do a join with the other collection. And what if the condition for documents from collection 2 was complex and slow. Also what if there was a thrid collection with a ManyToMany to collection 2.

It would be easier and faster if you could just say:

{"skipAndReturn": <condition>}

as a pipeline step.

 

 



 Comments   
Comment by Edwin Zhou [ 29/Mar/21 ]

Hi oocrytooo@gmail.com,

We haven’t heard back from you for some time, so I’m going to close this ticket. If you're still interested in this improvement, please provide additional information and we will reopen the ticket.

 

Best,

Edwin

Comment by Edwin Zhou [ 22/Mar/21 ]

Hi oocrytooo@gmail.com,

We still need additional information to understand your improvement request. Could you provide some additional information, such as an example use case along with example documents? Providing explicit details on the specific behavior will improve the chances of having this ticket assigned to a team to be evaluated against our currently planned work. We look forward to hearing back from you!

Best,
Edwin

Comment by Edwin Zhou [ 05/Mar/21 ]

Hi oocrytooo@gmail.com,

Thank you for your improvement proposal. Could you provide an example use case, some example documents, and a code snippet to better illustrate the behavior you're looking to add? It will also be helpful if you could help describe the data flow for this feature.

Best,
Edwin

Generated at Thu Feb 08 05:34:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.