Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-54860

Allow taking out elements from aggregation and include them in return

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      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.

       

       

        Attachments

          Activity

            People

            Assignee:
            edwin.zhou Edwin Zhou
            Reporter:
            oocrytooo@gmail.com Johannes Jumpertz
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: