java_home
Sunday, June 29, 2014
Homework: Homework 5.4 , Removing Rural Residents , calculate the number of people who live in a zip code in the US where the city starts with a digit
db.zips.aggregate([{$project:{city:{$substr:["$city",0,1]},pop:"$pop",_id:0}},{$match:{city:{$regex:'[0-9]'}}},{$group:{_id:null,pop:{$sum:"$pop"}}}])
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment