Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { Mail } = require('../config/MailModel.js');
  2. const { ObjectId } = require('mongoose').Types;
  3.  
  4. function markAsRead (id) {
  5.     Mail.findByIdAndUpdate(
  6.         id,
  7.         { unread: false },
  8.         { new: true },
  9.         function(err, doc) {
  10.             if (err) {
  11.                 console.log(err);
  12.             }
  13.             else {
  14.                 console.log('attempted to set unread to false on id: ', id, '\nwith the response of: ', doc);
  15.             }
  16.         }
  17.     );
  18. }
  19.  
  20. module.exports = markAsRead;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement