Answers for "mongodb find object field"

Go
3

mongodb find field based on variable

var name = req.params.name;
var value = req.params.value;
var query = {};
query[name] = value;
collection.findOne(query, function (err, item) { ... });
Posted by: Guest on May-25-2020
1

find only one field mongodb

db.students.find({}, {roll:1, _id:0})
Posted by: Guest on March-19-2021

Browse Popular Code Answers by Language