Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("../src/db/mongoose");
- const User = require("../src/model/user");
- const Task = require("../src/model/task");
- User.findByIdAndUpdate("5c8ce6e8beb985736310618f", { age: 1 })
- .then(user => {
- console.log(user);
- return User.countDocuments({ age: 1 });
- })
- .then(result => {
- console.log(result);
- })
- .catch(e => {
- console.log(e);
- });
- // same thing apply to task
- Task.findByIdAndDelete("5c8d373015cd9f96a0a7843f")
- .then(task => {
- console.log(task);
- return Task.countDocuments({ completed: false });
- })
- .then(result => {
- console.log(result);
- })
- .catch(e => {
- console.log(e);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement