mongodb, sort skip limit, pipeline -- Выясняем как тут сортировать данные при агрегации
Primary tabs
$sort + $limit Memory OptimizationWhen a sort immediately precedes a limit in the pipeline, the $sort operation only maintains the top n results as it progresses, where n is the specified limit, and MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
Changed in version 2.4: Before MongoDB 2.4, $sort would sort all the results in memory, and then limit the results to n results.
Optimizations are subject to change between releases.
-- цитата из крайне непонятного момента в документации
- Log in to post comments
- 4219 reads
vedro-compota
Mon, 01/22/2018 - 17:50
Permalink
не работает sort skip limit
проблема наблюдалась в 3.2 в 3.6 всё норм
то есть не работал запрос вида:
_____________
матфак вгу и остальная классика =)