mongodb find all documents with value code example
Example 1: 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) { ... });
Example 2: mongodb find element in array
db.yourCollection.find( { array: "element" } )