Reputation: 3721
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?
Upvotes: 0
Views: 79
Reputation: 3266
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});
Upvotes: 1