How do you check if a particular string value exists in a field in a mongo collection?
The standard collection.find
returns a cursor however, I am trying to get a true or false response.
So I am doing the following which is incorrect.
var booleanResponse = collection.find({}, {'field': 'valueToCheck'})
console.log(booleanResponse)
I also tried the following but the operation checks agains an array but my field holds a string...
var booleanResponse = collection.find({},
{ field: { $exists: true, $nin: [valueToCheck]} })