MongoDB
C100DBA · Question #12
C100DBA Question #12: Real Exam Question with Answer & Explanation
Sign in or unlock C100DBA to reveal the answer and full explanation for question #12. The question stem and answer options stay visible for context.
Question
Consider that you have a collection called population which has fields state and city. Which of the following query will calculate the population grouped by state and city?
Options
- Adb.population.aggregate( [{ $group: { _id: { state: "$state", city; "$city" },pop: { $sum: 1 > > >] )
- Bdb.population.aggregate( [{ $group: { _id: { state: Estate", city: "$city" },pop: { $pop: 1 } } }] )
- Cdb.population.aggregate( [{ $group: { _id: { state: Estate", city: n$city" },pop: { $sum: "$pop" } } }] )
- Ddb.population.aggregate( [{ $group: { _id: { city: "$city" },pop: { $sum: "$pop" } } }] )Multi
Unlock C100DBA to see the answer
You've previewed enough free C100DBA questions. Unlock C100DBA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.