Skip to content

Instantly share code, notes, and snippets.

@gharriso
Created February 15, 2018 00:23
Show Gist options
  • Save gharriso/1811e2f575c20cf022033fdbe6033788 to your computer and use it in GitHub Desktop.
Save gharriso/1811e2f575c20cf022033fdbe6033788 to your computer and use it in GitHub Desktop.
db.orders.find({customerId:customerId},{_id:1}).forEach((order)=>{
var rc1=db.lineitems.deleteMany({orderId:order._id});
});
var rc2=db.orders.deleteMany({customerId:customerId});
var rc3=db.customers.deleteOne({_id:customerId});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment