Skip to content
MongoDB

Operators API Reference

MongoDB query and aggregation operators used to filter, transform and group documents.

By EZ4Code Team

Operators

Common query and pipeline operators.

{ $match: <query> }

Aggregation stage that filters documents, behaving like a collection find query.

Returns: Stage

{ $group: { _id: <expr>, <field>: { <accumulator>: <expr> } } }

Aggregation stage that groups documents by _id expression and applies accumulators per field.

Returns: Stage

{ $project: <specification> }

Aggregation stage that passes only specified fields (with optional computed values) downstream.

Returns: Stage

{ $lookup: { from, localField, foreignField, as } }

Performs a left outer join to another collection in the same database.

Returns: Stage

{ $sort: { <field>: 1 | -1 } }

Aggregation stage that sorts documents by the given fields; 1 ascending, -1 descending.

Returns: Stage

More MongoDB API References