Docs Home → MongoDB Manual Show $group The
A group key is often a field, or group of fields. The group key can also be the result of an expression. Use the In
the The output documents can also contain additional fields that are set using accumulator expressions. Note
The
The The Changed in version 5.0.
The TipSee also:This section describes optimizations to improve the performance of
If a pipeline ExampleIf
a collection named
Starting in version 5.2, MongoDB uses the slot-based execution query engine to execute
For more information, see
In
The following aggregation
operation uses the
The operation returns the following result:
This aggregation operation is equivalent to the following SQL statement:
TipThe
following aggregation operation uses the
The operation returns the following result:
The following aggregation operation groups documents by the First Stage:The $group stage groups the documents by item to retrieve the distinct item values. This stage returns the totalSaleAmount for each item.Second Stage:The
$match stage filters the resulting documents to only return items with a totalSaleAmount greater than or equal to 100.The operation returns the following result:
This aggregation operation is equivalent to the following SQL statement:
TipSee also:In
The following pipeline calculates the total sales amount, average sales quantity, and sale count for each day in the year 2014: First Stage:The
$match stage filters the documents to only pass documents from the year 2014 to the next stage.Second Stage:The $group stage groups the documents by date and calculates the total sale amount, average
quantity, and total count of the documents in each group.Third Stage:The $sort stage sorts the results by the total sale amount for each group in descending order.The operation returns the following results:
This aggregation operation is equivalent to the following SQL statement:
The following aggregation operation specifies a group
The operation returns the following result:
This aggregation operation is equivalent to the following SQL statement:
In
The following aggregation operation pivots the data in the
The operation returns the following documents:
The following
aggregation operation groups documents by First Stage:
Second Stage:
NoteThe operation returns the following documents:
Tip
See also:The Aggregation with the Zip Code Data Set tutorial provides an extensive example of the What does the term group mean quizlet?A collection of people who interact with each other and share similar characteristics and sense of unity.
When social psychologists define a social group as a collection of interdependent people they mean quizlet?Terms in this set (23)
members are physically in the same place at the same time. When social psychologists define a social group as a collection of interdependent people, they mean that. members influence one another. .
Is the tendency to favor one's group?Ingroup favoritism—the tendency to favor members of one's own group over those in other groups—is well documented, but the mechanisms driving this behavior are not well understood.
Which of the following is true regarding groupthink quizlet?Which of the following is true regarding groupthink? d. Groupthink results in a tendency for team members to conform to group pressure in making decisions.
|