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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -