1
0
CompleteNodeJS/task-manager/playground/promise-chaining.js
2020-02-23 15:53:45 -07:00

14 lines
326 B
JavaScript

require('../src/db/mongoose')
const User = require('../src/models/user')
// 5e519e3404357c00d0777aee
User.findByIdAndUpdate('5e52f2612f736700e5a20797', { age: 1 }).then((user) => {
console.log(user)
return User.countDocuments({ age: 1 })
}).then((result) => {
console.log(result)
}).catch((e) => {
console.log(e)
})