I have this document:
...
"username" : "torayeff",
"profile" : {
...
"friends" : [
{
"_id" : "aSD4wmMEsFnYLcvmP",
"state" : "active"
},
{
"_id" : "ShFTXxuQLAxWCh4cq",
"state" : "active"
},
{
"_id" : "EQjoKMNBey7WPGamC",
"state" : "new-request"
}
]
...
}
...
This is a request to get only the "state" attribute of this user:
Meteor.users.findOne({_id: userId1, 'profile.friends._id': userId2},
{fields: {_id: 0, 'profile.friends.state.$':1} });
In the meteor, I get this error:
Exception while simulating the effect of invoking 'activateFriendship' Error: Minimongo doesn't support $ operator in projections yet...
How can I rewrite the above query without error in minimongo?
source
share