From 3a357614bc432178426eb230ebf9da80ca368c7c Mon Sep 17 00:00:00 2001 From: JayWll Date: Sat, 15 Feb 2020 12:30:03 -0700 Subject: [PATCH] Video 81: Deleting Documents --- task-manager/mongodb.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/task-manager/mongodb.js b/task-manager/mongodb.js index 19374f7..8e788db 100644 --- a/task-manager/mongodb.js +++ b/task-manager/mongodb.js @@ -12,26 +12,18 @@ MongoClient.connect(connectionURL, { useNewUrlParser: true }, (error, client) => const db = client.db(databaseName) - // db.collection('users').updateOne({ - // _id: new ObjectID("5db5ee43fc565d010091bda4") - // }, { - // $inc: { - // age: 1 - // } + // db.collection('users').deleteMany({ + // age: 38 // }).then((result) => { // console.log(result) // }).catch((error) => { // console.log(error) // }) - db.collection('tasks').updateMany({ - completed: false - }, { - $set: { - completed: true - } + db.collection('tasks').deleteOne({ + description: 'Install MongoDB' }).then((result) => { - console.log(result.modifiedCount) + console.log(result) }).catch((error) => { console.log(error) })