In Mongoose, I need to find elements in a collection and count them, and getting both the results of the find and count. I have tried
Model.find().count(function (err, count) {
// Get count, but cannot get results of find
});
Is there a way to get both find() and count() without calling them twice?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…