[SERVER-45433] Parameterized views Created: 09/Jan/20  Updated: 21/Jun/23

Status: Open
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 4.3.2
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Andrzej Taramina Assignee: Katya Kamenieva
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-10789 User-Parameterized Views Closed
Participants:
Case:

 Description   

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!



 Comments   
Comment by Katya Kamenieva [ 21/Jun/23 ]

Reopening this ticket to track support of generic variables in the view pipeline. 

Comment by Asya Kamsky [ 16/Jan/20 ]

Duplicate of existing ticket SERVER-10789 which was flagged for re-triage.

Comment by Danny Hatcher (Inactive) [ 09/Jan/20 ]

Thanks for providing the background info for why you're looking for this feature! I've given the ticket to our Query team to respond.

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