Help Mongo query

Q: how to query a property of an object of a collection in meteor?
eg:
I have the following users collection:

{
  _id: 'QwkSmTCZiw5KDx3L6',  // Meteor.userId()
  username: 'cool_kid_13', // Unique name
  emails: [
    { address: 'cool@example.com', verified: true },
  ],
  createdAt: new Date('Wed Aug 21 2013 15:16:52 GMT-0700 (PDT)'),
  profile: {
    name: 'Joe Schmoe'
  },
}

when i query it from the server side using the following code:
Meteor.users.find({profile.name:'Joe Schmoe'});
the compiler throws typo error.

when i query it as the following code, it simply returns nothing.
Meteor.users.find({'profile.name':'Joe Schmoe'});

BUT the mongo shell the following code works
db.users.find({'profile.name':'Joe Schmoe'});

ANY IDEA?

Is that on the client or on the server?

the quotes around profile.name are important, but the command returns a cursor. Have you tried the following on the server?

Meteor.users.findOne({'profile.name':'Joe Schmoe'});

Collection.find() doesn’t return the results, it returns a reactive cursor. To get the actual results, you’ve gotta use find().fetch().

it is on the server side

Well, it then returns something: a cursor (like others said). In the client, if the cursor itself is being used in a template inside an #each helper - {{#each cursorname}} - then Blaze will iterate the cursor for you. In the server, it is up to you to iterate the cursor.