I have subscriptions collection in the database, e.g:
[{
_id: new ObjectId(...),
query: {
size: { $in: [1, 2, 3] }
}
}, {
_id: new ObjectId(...),
query: {
name: { $eq: 'Shirt' },
}
}]
I need to find all subscriptions whose query matches the object. Is it possible? E.g:
Subscriptions.aggregate([{
$reverseMatch: {
size: 1,
name: 'Shirt',
},
}]);
query
with a value of{ size: { $in: [1, 2, 3] } }
?query
with that value. I've updated the question to make it clear.$or
like this or an exact match like this. Is that the kind of thing your looking for? These can be converted easily to an aggregate with match like this or thissubscriptions
collection's documents one by one in application level and run the query to see if they can match your provided object. Can you better explain what is your use case and what are you trying to do?