0

I want to match the value of address, from an object of arrays holding objects:

email: {
  verified: [
    {
      token: "gCCt1IUKXPfB4Lj3q_t2vDfiUhis87Ki7mVuR3YLDRD",
      address: "[email protected]",
      when: ISODate("2017-01-06T11:40:22.293Z")
    }
  ]
}

This didn't work:

Meteor.users.findOne({email: {$elemMatch: {address: email}}})

How can you do it when there's an array to traverse?

1 Answer 1

1

You've missed the array verified in your query, instead of $elemMatch you can just refer the object directly as shown below :

Meteor.users.findOne({"email.verified.address": email});
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.