This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip_code dma_code dma_description | |
01001 543 SPRINGFIELD - HOLYOKE | |
01002 543 SPRINGFIELD - HOLYOKE | |
01003 543 SPRINGFIELD - HOLYOKE | |
01004 543 SPRINGFIELD - HOLYOKE | |
01005 506 BOSTON (MANCHESTER) | |
01007 543 SPRINGFIELD - HOLYOKE | |
01008 543 SPRINGFIELD - HOLYOKE | |
01009 543 SPRINGFIELD - HOLYOKE | |
01010 543 SPRINGFIELD - HOLYOKE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//equivalent of MySQL SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName; | |
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}]); | |
//as above but ordered by the count descending | |
//eg: SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName ORDER BY cnt DESC; | |
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}, {$sort:{'cnt':-1}}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var i=99,w=" on the wall",t=" bottle",o=" of beer"; | |
for(;i;)b=i+(i^1?t+'s':t)+o,console.log(b+w+", "+b+".\nTake one down and pass it around, "+--i+(i^1?t+'s':t)+w) |