Skip to content

Instantly share code, notes, and snippets.

@gurdotan
Last active August 29, 2015 14:18
Show Gist options
  • Save gurdotan/5b4418b9ff2be6f17a38 to your computer and use it in GitHub Desktop.
Save gurdotan/5b4418b9ff2be6f17a38 to your computer and use it in GitHub Desktop.
MongoDB: Find users by creation date
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