Query by aggregates

Hello guys. I have some users collection, for example:
“events”: [
{‘name’: ‘test1’, amount: 300},
{‘name’:‘test2’, amount: 500}

How to make a query without aggregation framework where for every users summary amount from all events is greather than 600 for example?
I haven’t any poccibility to use aggregation functions without aggregation framework.

Your requirement is not clear.

What do you mean by summary amount from all events?

We are not event sure if the sample document you supplied should be matched or not. No amount is greater than 600 but 300+500 is.

Sample documents from the collection and same resulting documents with more explications.

Read Formatting code and log snippets in posts before posting more code or sample documents.

1 Like

Hi. Thank you for reply. In my case, i have array of purchases. So i want to query by customers who has at least 3 purchases or at least 100$ spent on purchases. Can i make such a query without using aggregation pipiline and groups?

Still not clear enough.