A. Field name 'price' in $min is missing quotes and $ prefix.
B. Using $max and $min together is not allowed.
C. The _id field cannot be a field name.
D. The pipeline is correct and has no errors.
Solution
Step 1: Check syntax of $min and $max usage
The $min accumulator uses price without quotes and $ prefix, which is incorrect. It should be "$price".
Step 2: Verify other parts of the pipeline
$max is correctly used with "$price". Grouping by "$category" is valid. Using both accumulators together is allowed.
Final Answer:
Field name 'price' in $min is missing quotes and $ prefix. -> Option A
Quick Check:
Field names need "$" prefix inside accumulators [OK]
Hint: Always quote and prefix field names with $ inside accumulators [OK]
Common Mistakes:
Omitting $ before field names inside accumulators
Thinking $min and $max cannot be used together
Misunderstanding _id field usage in $group
5. You have a collection of sales documents with fields region and amount. You want to find the smallest and largest sale amounts per region, but only for regions where the smallest sale is above 100. Which aggregation pipeline correctly achieves this?