PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 1st of May, 2020

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[22:23:23] <c4017> I have an aggregation question
[22:24:44] <c4017> I have a pipeline whose last stage is a limit to limit the amount of data returned (for pagination / so I don't have to fetch ALL the results at once)
[22:25:08] <c4017> I'm trying to determine how many documents are present before this limit command
[22:26:14] <c4017> Of course I can do two separate queries, one ending in {"$count": count} to get # of results, and another one ending with limit, but then the server has to perferm the whole aggregation twice
[22:27:29] <c4017> Can I somehow compute the # of documents and put that in a new filed in one/all document before the limit?
[23:01:07] <c4017> Not exactly what I wanted, but this works: https://stackoverflow.com/questions/20348093/mongodb-aggregation-how-to-get-total-records-count
[23:24:55] <c4017> but it's slow as shit. damn
[23:25:59] <c4017> probly because it runs 'results' => array( '$push' => '$$ROOT' ) which is what I wanted to avoid in the first place