1
0
Fork 0

Video 81: Deleting Documents

This commit is contained in:
JayWll 2020-02-15 12:30:03 -07:00
parent ecfb5078b1
commit 3a357614bc
1 changed files with 5 additions and 13 deletions

View File

@ -12,26 +12,18 @@ MongoClient.connect(connectionURL, { useNewUrlParser: true }, (error, client) =>
const db = client.db(databaseName) const db = client.db(databaseName)
// db.collection('users').updateOne({ // db.collection('users').deleteMany({
// _id: new ObjectID("5db5ee43fc565d010091bda4") // age: 38
// }, {
// $inc: {
// age: 1
// }
// }).then((result) => { // }).then((result) => {
// console.log(result) // console.log(result)
// }).catch((error) => { // }).catch((error) => {
// console.log(error) // console.log(error)
// }) // })
db.collection('tasks').updateMany({ db.collection('tasks').deleteOne({
completed: false description: 'Install MongoDB'
}, {
$set: {
completed: true
}
}).then((result) => { }).then((result) => {
console.log(result.modifiedCount) console.log(result)
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })