I have a table like the following
{ _id: 55db87ed69090a5e4b5515cf,
firstname: 'Bilbo ',
lastname: 'Baggins',
email: '[email protected]',
points: 0,
password: '$2a$05$o90atG0rfXQN5X7CLFa59e8QO1PcOcFvH47MXDxVmr2E3id7cSEIG',
__v: 0 }
When I run this I get all the results
User.find({points: req.params.points}, function (err, docs) {
console.log(docs);
});
How can I fetch all of the records with the points field? I want to be able to fetch all points of every user and count them up.
I am quite new to mongodb/mongoose and having trouble understanding it.