-
-
Save anonymous/e104f6e7a9f1f6b808dc to your computer and use it in GitHub Desktop.
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
[OUTPUT] | |
Fri Apr 24 13:10:50.139 [conn1] command api_profiler.$cmd command: { aggregate: "endpointresults", pipeline: [ { $match: { endpoint: ObjectId('5539efe4cee2b027063c1780'), created: { $gt: 604799.999956 } } }, { $group: { _id: "$endpoint", avg: { $avg: "$duration" } } } ] } ntoreturn:1 keyUpdates:0 locks(micros) r:7247 reslen:50 7ms | |
[CODE] | |
time = DateTime.now | |
fromTime = time.to_time - 7.days.ago | |
avg = Endpointresult.collection.aggregate([ | |
{"$match" => {"endpoint" => self._id, 'created' => {'$gt' => fromTime}}}, | |
{"$group" => {"_id" => "$endpoint", "avg" => {"$avg" => "$duration"}}} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment