Video 81: Deleting Documents
This commit is contained in:
parent
ecfb5078b1
commit
3a357614bc
@ -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)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user