You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
7.4.2
Node.js version
20.11
MongoDB server version
5.0.24
Typescript version (if applicable)
No response
Description
We have noticed that the Model.restore is removing the field deleted from the document.
This previously used to work.
We are using the use$neOperator with a value of false - in other words, all of our queries look for data where deleted = false as a result of dsanel/mongoose-delete#50.
The following change, made in version 1.0.1 has broken this functionality:
Prerequisites
Mongoose version
7.4.2
Node.js version
20.11
MongoDB server version
5.0.24
Typescript version (if applicable)
No response
Description
We have noticed that the
Model.restore
is removing the fielddeleted
from the document.This previously used to work.
We are using the
use$neOperator
with a value offalse
- in other words, all of our queries look for data wheredeleted = false
as a result of dsanel/mongoose-delete#50.The following change, made in version 1.0.1 has broken this functionality:
Before this code change, the
schema.statics.restore
was:After this code change, the function is:
The issue here, is that the
deleted
key is being removed from the model, which doesn't support how theuse$neOperator
works!I have tested the following which appears to work - could this be considered for the 7.6.x release please?
Steps to Reproduce
Configure the
mongoose-delete
plugin as follows:When you add this plugin to your schema, delete a document, and then try to restore it:
The
deleted
key has been removed from the underlying document.Expected Behavior
The deleted key should remain in the document, and have a value of
false
The text was updated successfully, but these errors were encountered: