0

I use mongoose-delete library in my project. After soft delete, soft deleted data will be in recycle bin (I use findDeleted to get soft deleted data)

const Course = require("../models/Course");
const { mutipleMongooseToObject } = require("../../util/mongoose");
class MEcontrollers {
  me(req, res, next) {
    Course.find({}).then((course) => {
      res.render("me/me", { course: mutipleMongooseToObject(course) });
    });
  }
  bin(req, res, next) {
    Course.findDeleted()
      .then((course) => {
        console.log(mutipleMongooseToObject(course));
        res.render("me/bin", { course: mutipleMongooseToObject(course) });
      })
      .catch(next);
  }
}
module.exports = new MEcontrollers();

but it doesn't work, it takes all data in MongoDB, Please help me, thanks

Here is console.log with findDeleted: enter image description here

0 Answers0