I need to apply a set of filters (queries) to the collection. By default, MongoDB applies the operator ANDto all requests sent to the function find. Instead of the whole, ANDI need to apply each request sequentially (one after another). That is, I need to run the first query and get a set of documents, run the second query for the result of the first query, etc.
Is it possible?
db.list.find({..q1..}).find({..q2..}).find({..q3..});
Instead:
db.list.find({..q1..}, {..q2..}, {..q3..});
Why do I need it?
Bcoz, the second query must use the aggregate function to get the first query instead of applying the aggregate to the whole collection.
source
share