MongoDB:聚合之累加操作符

参看原文。

官网:https://docs.mongodb.com/manual/reference/operator/aggregation/group/#considerations

累加操作符

名字 描述
$avg Returns an average of numerical values. Ignores non-numeric values.(返回平均值)
$first Returns a value from the first document for each group. Order is only defined if the documents are in a defined order.(返回第一个)
$last Returns a value from the last document for each group. Order is only defined if the documents are in a defined order.(返回最后一个)
$max Returns the highest expression value for each group.(返回最大值)
$min Returns the lowest expression value for each group.(返回最小值)
$push Returns an array of expression values for each group.
$addToSet Returns an array of unique expression values for each group. Order of the array elements is undefined.()
$stdDevPop Returns the population standard deviation of the input values.
$stdDevSamp Returns the sample standard deviation of the input values.
$sum Returns a sum of numerical values. Ignores non-numeric values.(返回总和)

猜你喜欢

转载自blog.csdn.net/chaiyu2002/article/details/80914028