I am trying to return documents where at least one element from the selected field array matches the query array.
I have tried the following queries:
const match_equipment = await studios.find({equipment: {$eleMatch:{$in: ["mic","amp"]}}});
const match_equipment = await studios.find({equipment: {$all: ["mic","amp"]}});
The 1st query gives me "db query failed error" 2nd one gives me "no result found".
Sample document:
{
"_id": {"$oid": "5ec5d38be97c8869bee29e78"},
"equipment": ["guitar", " mic", " amp"],
"studio_name": "Best recordings",
"email": "changed@gmail.com",
"address": "34 harming st. Brunswick",
"postcode": "3056",
"price": "50",
"__v": {"$numberInt": "0"},
"unavalibility": [
{
"times": [{"$numberInt": "13"}],
"_id": {"$oid": "5ec610e47cf2fb4e84ba0c54"}, "date": {"$date": {"$numberLong": "1591920000000"}}
}
]
}