Created
July 26, 2017 19:20
-
-
Save inakidelamadrid/2997651e6d3589c81771baf1e6dd6392 to your computer and use it in GitHub Desktop.
Querying MongoDB. Querying by date range and sorting based on date field
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
db.getCollection('user_sessions').find({ "$and":[ | |
{"created_at": {"$ne": null}}, | |
{"created_at": { $gte : new ISODate("2017-07-12T00:00:00Z") }} | |
]}) | |
.sort({"created_at": -1}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment