MongoDB Reference: CRUD, Aggregation Pipeline, Mongoose, Indexes and Transactions
MongoDB patterns that trip people up until they click.
Aggregation pipeline: $match goes first
db.collection("orders").aggregate([
{ $match: { status: "completed" } }, // USE INDEX HERE
{ $group: {
_id: "$customerId",
totalSpend: { $sum...
releaserun.hashnode.dev2 min read