The mongodb $or operator works as intended outside of a meteorjs context:
db.users.find({$or: [{email: '[email protected]'},{city: 'atlanta'}]});
I get results for any document that has email [email protected] or city of atlanta.
The same query in Meteor syntax doesn't yield the same results :
Users = new Meteor.Collection("users");
Users.find({$or: [{email: '[email protected]'},{city: 'atlanta'}]});
I've read the meteor docs - http://docs.meteor.com/#find - and since it doesn't say anything about it, I'm assuming it should run just the same as a mongodb 1.6+ instance?
find
returns a cursor object. You need to use a fetch
to get the array of values. Try:
console.log(Users.find({$or: [{email: '[email protected]'},{city: 'atlanta'}]}).fetch());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With