I have this piece of code :
db.collection('coders', function(err, collection) {
collection.find(toFind).toArray(function(err, items) {
res.send(items);
});
where toFind
is something like {"position":2,"$or":[{"position":{"$lt":20}},{"name":"whatever"}]}
It is a String, so the previous code doesn't execute, because it needs an object. I already know, that I can create object from String like
var obj={}
obj[key] = {value}
But how can I create an object without key ?