Last active
July 31, 2023 14:49
-
-
Save travist/5133ade419362685bb81d29034be4c2d to your computer and use it in GitHub Desktop.
Mongo Delete multiple projects and resources within it.
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.projects.find({_id: {$in: [ | |
ObjectId('63ebe4e2902342342db152a8'), | |
ObjectId('642324234234a13675034017'), | |
ObjectId('642c68506234234234241869'), | |
]}}).forEach(function(project) { | |
print('Deleting project ' + project.name); | |
db.submissions.deleteMany({project: project._id}); | |
db.actions.deleteMany({project: project._id}); | |
db.formrevisions.deleteMany({project: project._id}); | |
db.forms.deleteMany({project: project._id}); | |
db.roles.deleteMany({project: project._id}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment