149k views
1 vote
T or F: The $avg group accumulator ignores non-numeric values.

1 Answer

5 votes

Final answer:

The $avg group accumulator in MongoDB's Aggregation Framework ignores non-numeric values.

Step-by-step explanation:

The statement T or F: The $avg group accumulator ignores non-numeric values is True.

When using the $avg group accumulator in MongoDB's Aggregation Framework, it only considers numeric values and ignores non-numeric values. Non-numeric values are treated as if they were not included in the calculation, resulting in an average based only on the numeric values present in the data.

For example, if you have a collection with documents containing a field 'score', some of which are numeric and some are non-numeric (e.g., 'N/A' or 'Unknown'), using the $avg group accumulator will only consider the numeric values for the average calculation.

User Plafhz
by
7.6k points