Return subarray of specific document in meteor


#1

I want to retrieve specific subarray of my document, and I do that:

var userData = Meteor.users.find({_id: this.userId},{groups : {$elemMatch:{id:groupId}}});
console.log(userData);

But the console.log() return me all data of specific user, no only the subarray, also I tried with findOne.

Someone can help me, please?


#2

The syntax for your query is wrong.

Collection.find( query, options);

looks like you put part of the query into the options