@stenneepro/mongoose-soft-delete
Version:
Mongoose soft delete plugin
15 lines (14 loc) • 442 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
function default_1(schema) {
schema.query.withDeleted = function () {
return this.setOptions({ ignoreDeleted: true });
};
schema.query.notDeleted = function () {
return this.where({ deleted: false });
};
schema.query.onlyDeleted = function () {
return this.where({ deleted: true });
};
}