Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Stages of MongoDB pipeline aggregation

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Each stage of pipeline polymerization

Name

Description

$project

Transform documents in the flow, such as by adding new fields or removing existing fields. For each input document, output one document.

$match

Filter the document stream to allow only matching documents to move on to the next pipeline phase without modification. $match uses a standard MongoDB query. For each input document, the output is either one document (match one) or zero documents (no match).

$redact

Transform each document in the flow by limiting the content of the document (based on its own information stored in the document). Combine the functions of $project and $match. Can be used to implement field-level revisions. For each input document, the output is either one or another document.

$limit

When n specifies a value, the first n documents are passed to the pipe without modification. For each input document, the output is either one document (for the first n documents) or zero documents (after the first n documents).

$skip

When n is specified as the skip number, the first n documents are skipped and the remaining documents are passed to the pipe without modification. For each input document, the output is either zero (for the first n documents) or one document (if it is after the first n documents).

$unwind

For each element, output a document from the input document deconstructed array field. Each output document replaces the array with element values. For each input document, when n is the number of array elements, output n documents, for an empty array can be zero.

$group

Group the input document by specifying the identifier expression, and apply the accumulator expression, if specified, to each group. Iterate through all the input documents and output one document for each different group. The output document contains only identifier columns and calculated columns, if specified.

$sort

Rearranges the document stream by the specified sort key. Only the order has changed; the document remains the same. For each input document, output one document.

$geoUear

Returns a sorted stream of documents based on adjacent geospatial points. For geospatial data, combine $match, $sort, and $limit functions. The output document contains an additional distance field and can contain a location identifier field.

$out

Write the result document of the aggregation pipeline to a collection. When using the $out phase, it must be the last stage in the pipeline.

Additional resources

MongoDB Analytics: Learn Aggregation by Example: Exploratory Analytics and Visualization Using Flight Data

MongoDB for Time Series Data: Analyzing Time Series Data Using the Aggregation Framework and Hadoop

The Aggregation Framework

Webinar: Exploring the Aggregation Framework

Quick Reference Cards

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report