Last active
July 26, 2017 20:53
-
-
Save guenodz/998d18238b9bc6217713cfc84f2619bd to your computer and use it in GitHub Desktop.
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
// Find the total number of posts | |
db.getCollection('COLLECTION_NAME').find({}).count() | |
// Find posts published before a particular date (Ex: before April 4th, 2016) | |
db.getCollection('COLLECTION_NAME').find({"created_time" : {$lt: ISODate("2016-04-04T00:00:00.000Z")} }) | |
// Find posts published after a particular date (Ex: after April 4th, 2016) | |
db.getCollection('COLLECTION_NAME').find({"created_time" : {$gt: ISODate("2016-04-04T00:00:00.000Z")} }) | |
// Find posts published between two particular dates sorted in an ascending order (Ex: between April 4th, 2016 and May 4th, 2016) | |
db.getCollection('COLLECTION_NAME').find({"created_time" : {$gt: ISODate("2016-04-04T00:00:00.000Z"), $lt: ISODate("2016-05-05T00:00:00.000Z")} }).sort({"created_time": 1}) | |
// Find posts published by a particular member | |
db.getCollection('COLLECTION_NAME').find({"from.name" : "FULL_NAME"}).sort({"created_time": 1}) | |
// Find posts by type (Ex: status posts. You can search by any other type in: ["video", "link", "photo", "event", "note", "album"] ) | |
db.getCollection('COLLECTION_NAME').find({"type" : "status"}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment