MongoDB $ or query in Meteor?

Mongodb $ or operator works as outside the context of meteorites:

db.users.find({$or: [{email: 'some@mail.com'},{city: 'atlanta'}]}); 

I get results for any document with some@mail.com or atlanta city email.

The same query in Meteor syntax does not produce the same results:

 Users = new Meteor.Collection("users"); Users.find({$or: [{email: 'some@mail.com'},{city: 'atlanta'}]}); 

I read the meteor documents - http://docs.meteor.com/#find - and since it doesn't say anything about it, I assume it should work just like a mongodb 1.6+ instance?

+8
mongodb meteor
source share
1 answer

find returns a cursor object. To get an array of values ​​you need to use fetch . Try:

 console.log(Users.find({$or: [{email: 'some@mail.com'},{city: 'atlanta'}]}).fetch()); 
+20
source share

All Articles