Skip to content

Instantly share code, notes, and snippets.

@lolobosse
Created July 4, 2016 08:26
Show Gist options
  • Save lolobosse/1b8cd4c534e8faa9551cdee9559e9d65 to your computer and use it in GitHub Desktop.
Save lolobosse/1b8cd4c534e8faa9551cdee9559e9d65 to your computer and use it in GitHub Desktop.
var i = 0;
db.getCollection('fs.files').find({}).forEach(function(element){
if (!db.getCollection('_User').find({profilePicture: element.filename}).toArray().length > 0){
i++;
db.getCollection('fs.files').remove({filename: element.filename})
}
})
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment