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
#!/bin/bash | |
# Author: Carl Loa Odin <[email protected]> | |
# https://gist.github.com/loa/435da12af9494a112daf | |
test_res=0 | |
function get_git_version() { | |
version=$(git describe) | |
if [ $? -eq 128 ]; then | |
# Return initial version incase no tags is found |
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 = db.getSiblingDB("whyd_music") // explicitely select collection | |
var jan2014 = ObjectId("52c35a800000000000000000"); // created using http://steveridout.github.io/mongo-object-time/ | |
db.post.aggregate([ | |
{"$sort": {"_id": -1}}, // order: antichronological | |
{"$match": {"_id": {"$gt": jan2014}}}, // only documents that were created after the 1syt january 2014 | |
{"$group": {"_id": "$eId", // group by value of the eId attribute -> _id attribute in the resulting output collection | |
"name": {"$first": "$name"}, // -> include the name of each grouped category | |
"count": {"$sum": 1}}}, // -> count attribute will contain the number of documents for each value of _eid | |
{"$match": {"count": {"$gt": 50}}}, // limit output to results with count > 50 | |
{"$sort": {"count": -1}} // output order: highest count first |