1

i have database like

 "profile" : {
    "firstName" : "dh",
    "lastName" : "french",
    "roles" : [ 
        "applicant"
    ]
},

i want to find whose roles is applicant so i try this query

 var data = Meteor.users.find({
        "profile.roles": { $in: ["applicant"] }
    }).fetch();

but i always get 0 length data so,which query is righ

1
  • your query structure is correct, but in your sample you're looking for admin, not applicant Commented Aug 28, 2017 at 12:43

1 Answer 1

2

In this case, you don't need to use $in operator. Take is easy:

 Meteor.users.find({
    "profile.roles": "applicant"
 }).fetch();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.