From 573d7d39dc32ae1d7cfcfc2aff872e8220e0f436 Mon Sep 17 00:00:00 2001 From: chencheng Date: Thu, 13 Nov 2014 14:47:11 +0800 Subject: [PATCH] perf(index): limit query count to improve index performance --- lib/download.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/download.js b/lib/download.js index 18bbfd8..2dd5b16 100644 --- a/lib/download.js +++ b/lib/download.js @@ -16,7 +16,7 @@ exports.save = function(package) { }; exports.stat = function(callback) { - return download.find({}).sort({ time: -1 }).exec(function(err, results) { + return download.find({}).limit(50).sort({ time: -1 }).exec(function(err, results) { var res = []; var todayDownloads = []; for (var i in results) {