I want to save the amount of documents of a collection in "const amount_documents". As described in this question: How to get all count of mongoose model? you can not simply write
const amount_documents = User.count();
What is the correct way to do this? When I use this code:
var myCallback = User.count({}, function(err, count) {
callback(count);
});
it says "callback is not defined"