Although I am skeptical that this is achievable, I will give it a shot here.
Below are some examples of records in the database:
{
type: 'fruit',
name: 'apple',
quantity: 3
}
{
type: 'fruit',
name: 'orange',
quantity: 10
}
{
type: 'vegetable',
name: 'tomato',
quantity: 4
}
{
type: 'meat',
name: 'beef',
quantity: 2
}
Now, let's take a look at the query:
{type: { $in: ['fruit', 'vegetable', 'meat']}}
This query will return all records in the collection with types 'apple', 'orange', 'tomato', and 'beef'.
I am interested in querying 'fruit', 'vegetable', 'meat', and also the records with quantities greater than 5 for
'fruit' specifically, not the others
.
Therefore, the desired result would be:
orange, tomato, beef
I am unsure if my explanation is clear, but is this type of query possible? Or should I consider running two separate queries? Thank you for your time.