Reputation: 498
I want to limit a query and get its total length in mongoose
like this:
comment: [1,2,3,4,5,6,7,8,9,10] //length 10
const comments = await CommentModel.find().limit(3).count() //this does not work;
console.log(comments)
output:
{ length: 10, comments: [1, 2, 3] }
thanks a lot.
Upvotes: 0
Views: 61