Variable object with dot notation in find not working - is it a bug?

Dot notation like find({ ‘profile.interest’: ‘bla’ }) works, however when retrieving objects from a variable it is not working. This is probably a JavaScript limitation but perhaps it should be working? There’s a jsfiddle below to further demonstrate the issue.

return collection.find({ 'profile.interest': 'bla' })

and …

var query = {}; query['profile.interest'] = 'bla'; return collection.find(query);

…are functionally the same. If that’s not working for you then there is either a bug in javascript (unlikely) or a bug in your app that is interfering.

If you publish a Meteor app reproducing the issue to github, you’ll be able to get more help.

I’m not sure if you have figured it out, but one of the lines in your jsfiddle will really not work:

return Meteor.users.find({ 'profile.interstone' = Meteor.user().profile.interestone}); 
// Should be
return Meteor.users.find({ 'profile.interstone' : Meteor.user().profile.interestone}); 

Do you have a git repo that shows the issue?

I would also suggest that profile.interstone should be profile.interestone

Ouch, you’re right. I had a typo with interestone. Sorry for posting. Nobody saw that typo on IRC either and someone suggested it’s a JS limitation, not meteor’s. Thanks everyone :slight_smile: !

Glad it worked out for you. In the future, if you console.log(Meteor.user().profile), you would have seen a new field created with the set called interstone. You might check out Mongol, which may have helped you catch this…