Created
June 16, 2018 17:01
-
-
Save barisusakli/79fdcfabb27066f00aa94175714597d8 to your computer and use it in GitHub Desktop.
Query user settings and users in mongodb
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
var uids = []; | |
db.objects.find({_key: /^user:\d+:settings/, showemail: 1}).forEach(function(obj) { | |
uids.push(obj._key.split(':')[1]); | |
}); | |
var userKeys = uids.map(function (uid) { | |
return 'user:' + uid; | |
}); | |
print(uids); | |
db.objects.find({_key: {$in: userKeys}}).forEach(function (userObj) { | |
print(userObj.username, userObj.email); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment