I'm encountering an issue with my code snippet:
collection.find({title:"foo"}, {title:1, _id:0})
It successfully returns
{title: "foo"}
However, when I attempt the following:
str = "foo";
collection.find({title:str}, {title:1, _id:0})
No results are being returned.
All the solutions I've come across on stackoverflow involve using fixed strings. How can I search for a string that is constantly changing within a mongodb database?