1.

Point out the wrong statement.(a) $avg is an accumulator operator available only in the $group stage(b) $sum accumulator can be used to compute the total amount and count for each group of documents(c) $avg ignores numeric values(d) All of the mentionedThe question was posed to me in unit test.My question comes from Pipeline Operators topic in portion Aggregation Concepts and Aggregation Mechanics of MongoDB

Answer»

The CORRECT answer is (c) $avg ignores numeric values

Easy explanation: $avg returns the AVERAGE value of the numeric values that result from applying a specified expression to each DOCUMENT in a GROUP of documents that share the same group by key.



Discussion

No Comment Found

Related InterviewSolutions