0% found this document useful (0 votes)
16 views2 pages

MongoDB Aggregation Operators

The document outlines various MongoDB aggregation pipeline operators categorized into filtering, reshaping, grouping, aggregating, array handling, joining, sorting, sampling, and advanced operations. Key operators include $match for filtering, $group for aggregation, and $lookup for joining collections. It provides a comprehensive overview of functionalities to manipulate and analyze data within MongoDB.

Uploaded by

yogesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views2 pages

MongoDB Aggregation Operators

The document outlines various MongoDB aggregation pipeline operators categorized into filtering, reshaping, grouping, aggregating, array handling, joining, sorting, sampling, and advanced operations. Key operators include $match for filtering, $group for aggregation, and $lookup for joining collections. It provides a comprehensive overview of functionalities to manipulate and analyze data within MongoDB.

Uploaded by

yogesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MongoDB Aggregation Pipeline Operators

Filtering & Reshaping

$match : Filters documents by criteria

$project : Selects/reshapes fields

$addFields : Adds or updates fields

$unset : Removes fields

$replaceRoot : Replaces the root with a specified document

$replaceWith : Alias for $replaceRoot

$redact : Restricts fields dynamically

Grouping & Aggregating

$group : Groups documents by a key with accumulations

$count : Counts number of documents

$bucket : Categorizes into buckets based on ranges

$bucketAuto : Automatically buckets based on document count

$sortByCount : Combines $group + $sort to count group frequencies

Array & Nested Document Handling

$unwind : Splits array fields into multiple documents

Join & Recursive

$lookup : Joins with another collection

$graphLookup : Recursive join (tree or graph structures)

Sorting, Sampling, Pagination

$sort : Sorts documents

$limit : Limits document count

$skip : Skips specified count

$sample : Random sampling

Multi-Stage / Advanced

$facet : Run multiple pipelines in parallel


MongoDB Aggregation Pipeline Operators

$merge : Writes output to a collection (like $out, but safer)

$out : Writes results to a collection (replaces content)

$unionWith : Combines results from other collection(s)

$indexStats : Returns index usage statistics

$currentOp : Returns running operations

$collStats : Collection statistics

$planCacheStats : Info on cached query plans

You might also like