aggregation framework - MongoDB - How to combine two Sorts -


i want stipulate sort critical point of time: $currentdate. means, sort old dates in descending order, future dates in ascending order.

---future--- 18.5 17.5 16.5 ---today--- 14.5 13.5 12.5 ---past--- 

to become:

---future--- 16.5 17.5 18.5 ---today-- 14.5 13.5 12.5 ---past--- 

it's gonna done aggregation framework, might consist of $cond, , prefer begin descending sort take advantage of index. appreciate piece of advice!


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -