Skip to content

Commit

Permalink
feat: use report count estimates
Browse files Browse the repository at this point in the history
  • Loading branch information
karpawich committed Apr 7, 2021
1 parent 61cf8cf commit 73edc7d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/analytics/stats-queryer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ StatsQueryer.prototype.count = function(type, callback) {

StatsQueryer.prototype._countReports = function(query, callback) {
query || (query = {});
Report.countDocuments(query, callback);
Report.estimatedDocumentCount(query, callback);
};

StatsQueryer.prototype._countIncidents = function(query, callback) {
Expand Down
2 changes: 1 addition & 1 deletion lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mongoose.Model.findPage = function(filters, page, options, callback) {

// execute count and find in parallel fashion to avoid waiting for each other
async.parallel([
model.countDocuments.bind(model, filters),
model.estimatedDocumentCount.bind(model, filters),
function(callback) {
var query = model.find(filters, null, options);
if (populate) query = query.populate(populate);
Expand Down

0 comments on commit 73edc7d

Please sign in to comment.