Created
December 31, 2014 09:26
-
-
Save olgakogan/49596cba8d8177813970 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
######### using python mongoengine | |
min_age = Customer.objects(zip_code = 687218).order_by("age").first().age | |
max_age = Customer.objects(zip_code = 687218).order_by("-age").first().age | |
######### using mongo client commands | |
#MIN | |
db.customers.find({"zip_code":683749}).sort( { age: 1 } ).limit(-1) | |
#MAX | |
db.customers.find().sort( { age: -1 } ).limit(-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment