I’ve been working on a little program like an annual report. The database I’m going to be using is MongoDB, and I’ve never used it before, so I’m going to write down some of my notes.

MongoDB aggregate query

For convenience, use MongoDB Compass, the official MongoDB visualization tool. Choose Aggregations.And then I’m going to select match here.

Then enter the query criteria.

This is the aggregated query for the first step. Then we click the plus sign in the upper right to add the second query. Operation method is the same as above.