How can the results of a query be counted without loading the entire result in the memory?
The easy way to calculate the given documents will be:
var q = model.query ('mycollection', {date: today}); Q.fetch (function () {var length = q.get (). Length;});
But this will load the whole result in memory and "count" an array in JavaScript. When you have a lot of data, you do not want to do it, I guess.
Built-in mongodb archive is rather complicated by LiveDB (I think it is LiveDB) creates several mongodb documents for a derbyjs document.
International point to this fact from 2013, but there is a description of the solution there (by entering $ count: true
query options) 0.6 and work in the current mangodeb. ". query.extraRef
is undefined
.
This is done as described in the Google Groups thread. But query.extraRef
now query.refExtra
.
example:
q.refExtra ('_page.docsOfToday'); q.fetch ();
No comments:
Post a Comment