Reputation: 63
Sorry for the confusing title, I'm having a hard time describing it.
Basically, here is the document I have stored in my database:
_id: 5fcf596a27365fb14d938afa
vatid:"BE00000011"
name:"ACME Inc"
users: [ {
_id: 5fcf596a27365fb14d938afb,
id: 5fcf596a27365fb14d938af9,
role:"admin"
}
]
Id like to find the object that contains this id: 5fcf596a27365fb14d938af9 inside the users array.
What would the query look like?
Thanks!
Upvotes: 0
Views: 272
Reputation: 1837
This should do the thing:
{"users.id" : "5fcf596a27365fb14d938af9"}
Upvotes: 1