Video 94: Promise Chaining Challenge
This commit is contained in:
parent
6f0cc2fdaa
commit
935b79740f
11
task-manager/playground/promise-chaining-2.js
Normal file
11
task-manager/playground/promise-chaining-2.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
require('../src/db/mongoose')
|
||||||
|
const Task = require('../src/models/task')
|
||||||
|
|
||||||
|
Task.findByIdAndDelete('5e52f573b7d229017fe21321').then((task) => {
|
||||||
|
console.log(task)
|
||||||
|
return Task.countDocuments({ completed: false })
|
||||||
|
}).then((result) => {
|
||||||
|
console.log(result)
|
||||||
|
}).catch((e) => {
|
||||||
|
console.log(e)
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user