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

Parameterized views

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.3.2
    • Component/s: Aggregation Framework
    • None

      Right now, views are based on a static aggregation pipeline.

      It would be really useful to have some sort of mechanism where parameter values could be passed into the view pipeline.

      For example, say you have a collection, fruits, with complex apple, pear and banana documents in it.

      Rather than having to set up 3 separate views, view_fruits_apple, view_fruits_pear and view_fruits_banana, to return the results of three agg pipelines that hardcode the fruit value, it would be very useful to have one view: view_fruits and a way to pass a parameter for the fruit that you want selected/set in the pipeline.

      In some cases, you could set up the generic view, and then use a simple query to do the filtering, but that only works well when the result of each pipeline is identical, which in our use case (healthcare) is not the case (the above is just a very simple example to illustrate the desired feature). In our real world scenarios, each pipeline has major differences, groupings, calculations, and trying to merge all those into a single mega-complex aggregation is just not feasible from a maintenance perspective, since each pipeline will be quite complex already.

      The tricky part would be creating a mechanism where the user of the view could inject the parameters. Maybe add a "pipeline_parameters" value in the options object passed into a query, or some such, since that would fit the current API without much disruption.

      Thanks!

            Assignee:
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Reporter:
            ataramina@shorecg.com Andrzej Taramina
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: