Hi Jason,
Thankyou for the reply.
I am trying to explain my use case here.
Actually I have a database of let say 3000 users which are from different locations all around the globe.
I want to get these data through a NodeJS API which returns data in sorted order (Not Filtered).
Sorting can be done in multiple ways like
- Latest users coming first ( that I have implemented using {sort:created:-1}
- Old users coming first ( that I have implemented using {sort:created:1}
- Salary ({salary:-1})
All these sorting returns all the data, just the ordering changes according to the sorting condition provided.
Similarly I want to create one more 4th filter which will be named as “Recommended”
4. Recommendation filter returns the users in sorted order according to the Logged in users interests. Like a user of USA is logged in then, I want users of USA to come at top, then others at later. Similarly I want to set some priorities to some fields to get the data in that sorted order. Hope this use case helps you understand my need.
P.s. I tried using $facet but that does’t seemed an optimized way to me as I am getting duplicate data many times, also I can’t face multiple priorities.Attaching a screenshot of sample code.
