meteor - Why is this MongoDB selector not working? -
i have simpleschema attached meteor.users following property:
tags: { type: [object], label: "tags", optional: true, } }, 'tags.$.name' : { type: string, }, 'tags.$.correct' : { type: number, }, 'tags.$.wrong' : { type: number, },
and have created user single "tag" object
"tags" : [ { "name" : "history", "correct" : 0, "wrong" : 1 }, ]
but when make call
meteor.users.findone({ 'tags.$.name' : "history" });
it returns undefined
. know doing wrong?
thank helping. has been stalling me days. =\
you need specify fields option in findone
statement.
this worked me:
meteor.users.findone({ 'tags.name': "history" }, { fields: {'tags.$': 1} });
Comments
Post a Comment