Last active
August 29, 2015 14:18
-
-
Save gurdotan/5b4418b9ff2be6f17a38 to your computer and use it in GitHub Desktop.
MongoDB: Find users by creation date
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.users.find({created_at: {$gt: new ISODate('2015-03-29 00:53:55.997Z')}}).sort({_id: 1}).forEach(function(d) { | |
var firstName = d.name.split(/\s+/)[0]; | |
var match = d.name.match(/.*\s+(.*)/); | |
var lastName = match ? match[1] : ''; | |
print(d.email + '\t' + firstName + '\t' + lastName); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment