I have a Account collection that contains members field which is an array containing the object ids of users
Account collection
{
"_id": {
"$oid": "613fc4a36e988e7ed19ae41c"
},
"company": {
"$oid": "6189a18726ab98246e00e2fa"
},
"admin": {
"$oid": "619541a4cf6b272b14d6508a"
},
"members": [
{
"$oid": "5b43e81d7f621fc06c01a376"
},
{
"$oid": "619541a4cf6b272b14d6508a"
},
{
"$oid": "56ae2f0d747777c99c2aecc2"
}]
}
User collection
{
"_id": {
"$oid": "5b43e81d7f621fc06c01a376"
},
"profile": {
"name": {
"first": "surjit",
"last": "prafullit"
}
},
"status": "Active"
}
I want to implement search on Accounts collection with member's name. I want only those accounts that has the searched member.
Example: If I search "Surjit" in the accounts collection, then I should get the above account and all the other account that has "surjit" as a member.