daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require("../src/db/mongoose");
  2. const User = require("../src/model/user");
  3. const Task = require("../src/model/task");
  4. User.findByIdAndUpdate("5c8ce6e8beb985736310618f", { age: 1 })
  5.   .then(user => {
  6.     console.log(user);
  7.     return User.countDocuments({ age: 1 });
  8.   })
  9.   .then(result => {
  10.     console.log(result);
  11.   })
  12.   .catch(e => {
  13.     console.log(e);
  14.   });
  15.  
  16.  
  17. // same thing apply to task
  18.  
  19. Task.findByIdAndDelete("5c8d373015cd9f96a0a7843f")
  20.   .then(task => {
  21.     console.log(task);
  22.     return Task.countDocuments({ completed: false });
  23.   })
  24.   .then(result => {
  25.     console.log(result);
  26.   })
  27.   .catch(e => {
  28.     console.log(e);
  29.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top