我试图对已定义项的表行进行计数,但希望在2000年停止计数,而不是继续进行10,000s。我不确定是否可以中断count以及是否可以返回中断值(2000)。大多数计数请求小于2000,但有时可能更高。我已经尝试过“限制”和“拥有”。赞赏任何见解。含糊不清的道歉-仍然是新的。
exports.countByType = function (type, done) {
db('boxes')
.count('id AS count')
.where('type', type)
.first()
.then(function (row) {
done(null, row.count);
})
.catch(function (err) {
done(err)
})