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)
// 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)
})