I have following documents
users = [
{ name: 'kiran', age: 22, location: 'pune' },
{ name: 'rahul', age: 23, location: 'mumbai' },
{ name: 'amit', age: 25, location: 'nashik' },
{ name: 'abhijeet', age: 26, location: 'pune' }
]
I have to find users based on multiple locations, So I have input array locations = ["pune", "nashik"].
It should result in three documents except one whose name is rahul because input array doesn't match his location.
output = [
{ name: 'kiran', age: 22, location: 'pune' },
{ name: 'amit', age: 25, location: 'nashik' },
{ name: 'abhijeet', age: 26, location: 'pune' }
]
So how can I achieve this with MongoDB.
thanks for any help.