This file contains hidden or 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
| db.zips.aggregate([ | |
| {$project: | |
| { | |
| fc: {$substr : ["$city",0,1]}, | |
| city:1,pop:1 | |
| } | |
| }, | |
| {$match:{fc:{$lte:"9",$gte:"0"}}} , | |
| { | |
| $group: { |
This file contains hidden or 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
| db.stud.aggregate([ | |
| {$match:{"scores.type":{$in:["exam","homework"]}}}, | |
| {$unwind:"$scores"}, | |
| {$group:{_id:"$class_id",csall:{$avg:"$scores.score"}}}, | |
| {$sort:{csall:-1}}, | |
| {$limit:5} | |
| ] | |
| ) |
This file contains hidden or 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
| import heroku | |
| HEROKU_TOKEN = "xx-xx-xx" #used for instance restart | |
| APP_NAME = "xxx" | |
| def restart_heroku(auto=False): | |
| '''restart heroku instance to re-allocate IP''' | |
| cloud = heroku.from_key(HEROKU_TOKEN) | |
| app = cloud.apps[APP_NAME] | |
| for p in app.processes: | |
| p.restart() |
OlderNewer