“db.usf_locations.find()” returned the following documents….
“db.usf_locations.find()” returned the following documents. { “campus_name” : “USF Downtown Campus”, “department” : [ { “name” : “Master of Science In Data Science”, “building” : “101 Howard” }, { “name” : “Bachelor of Science in Management”, “building” : “101 Howard” }, { “name” : “Bachelor of Science in Management”, “building” : “101 Howard” } ], “address” : { “street” : “101 Howard St”, “city” : “San Francisco”, “state” : “CA”, “zip” : NumberInt(94105) }}{ “campus_name” : “Main Campus USF”, “department” : [ { “name” : “School of Nursing and Health Professions”, “building” : “Cowell Hall” }, { “name” : “Fromm Residence Hall”, “building” : “Fromm Hall” }, { “name” : “Computer Sience Department”, “building” : “Harney SCIenCe Center” }, { “name” : “Environmental Science Department”, “building” : “Harney Science Center” }, { “name” : “Arts and Social Sciences Departments”, “building” : “Kalmanovitz Hall” } ], “address” : { “street” : “2130 Fulton Street”, “city” : “San Francisco”, “state” : “CA”, “zip” : NumberInt(94117) }} What is the output of the following query? db.usf_locations.aggregate({$unwind:”$department”}, {$project:{“campus_name” : true, “address.city”:true}}, {$group: {‘_id’:’$address’, ‘count’: {$sum:1}}})
Read Details