From bb4943bd0e0423afd2b7421a7e5cf2a8a0cbb1cc Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Wed, 29 Nov 2017 21:44:37 -0500 Subject: [PATCH] delete script --- playground/mongodb-delete.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/playground/mongodb-delete.js b/playground/mongodb-delete.js index 4cee234..02e905b 100644 --- a/playground/mongodb-delete.js +++ b/playground/mongodb-delete.js @@ -21,6 +21,13 @@ MongoClient.connect(mongoUrl, (err, db) => { var todo = db.collection("Todos").findOneAndDelete({text: "Something to do"}).then((result) => { console.log(result); }); + db.collection('Users').deleteMany({name: 'Tyrel'}).then((results) => { + console.log(JSON.stringify(results, null, 2)); + }) + + db.collection('Users').findOneAndDelete({_id: new ObjectID('5a1e463bf08a5672016ddd88')}).then((results) => { + console.log(JSON.stringify(results, null, 2)); + }) // db.close(); })