Answers for "mongodb get 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
8

mongodb select fields

db.inventory.find( { status: "A" }, { item: 1, status: 1 } )
Posted by: Guest on September-24-2020

Browse Popular Code Answers by Language