Last active
August 28, 2017 12:52
-
-
Save claustres/b3b645b7c9e55da374e339af1eb4581c to your computer and use it in GitHub Desktop.
Query MongoDB collection
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('random'); | |
var start = new Date(); | |
printjson(db.randomData.aggregate([ { $group : { _id: null, max: { $max : "$value" }}} ], {allowDiskUse: true}).toArray()); | |
print('Find maximum value in ' + (new Date() - start)/1000.0 + 's'); | |
start = new Date(); | |
printjson(db.randomData.find( { value: { $gt: 99.9 } } ).sort({ value: -1}).limit(100).toArray()); | |
print('Find values > 99.9 in ' + (new Date() - start)/1000.0 + 's'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment