2 / 2
Aug 2024

When reviewing the compatibility changes documentation I noted there we some operators listed as being removed: https://www.mongodb.com/docs/upcoming/release-notes/6.0-compatibility/#removed-operators

After upgrading these seem to still be working, they are also listed in the version 7.0 documentation: https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/. I don’t think I fully understand this note in the doc or I’m interpreting it incorrectly. Does anyone have additional insight on this?

There may be some ambiguity here (naming things is hard). The example you shared is the $min aggregation operator, whereas what’s been deprecated is the $min query modifier.

For example, you can still do the following in 6.0+:

db.sales.aggregate( [ { $group: { _id: "$item", minQuantity: { $min: "$quantity" } } } ] )

however you would no longer be able to do:

db.sales.find({ $query: {}, $min: { quantity: 25 } });

but would instead need to use the cursor methods such as:

db.sales.find({}).min({ quantity: 25 });