Allow taking out elements from aggregation and include them in return

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

       

       

            Assignee:
            Edwin Zhou
            Reporter:
            Johannes Jumpertz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: