mongoose-soft-delete icon indicating copy to clipboard operation
mongoose-soft-delete copied to clipboard

Cannot update a document with softDelete

Open cguilarte opened this issue 10 months ago • 6 comments

I am trying to update a document, but it won't let me, now if I manage to remove the softdelete from the mongo schema it works for me, therefore I think there is a problem with the plugin. I give example:

Captura de pantalla 2024-04-10 a la(s) 1 58 03 p  m Captura de pantalla 2024-04-10 a la(s) 1 58 37 p  m

I hope you can help me.

cguilarte avatar Apr 10 '24 16:04 cguilarte

Hi @cguilarte ,

I am willing to help in this case. I tested the updateMany with a unit test and it works.

You can find the unit test here.

What is generateId() in your code? Does it return an ObjectId object?

Willis0826 avatar Apr 13 '24 09:04 Willis0826

Hello @Willis0826 , thank you for responding, I will continue testing and checking that I am not placing something wrong, and yes, generateId returns an objectId, I still tried with other attributes and nothing.

cguilarte avatar Apr 16 '24 11:04 cguilarte

Would be great if you can share a project with me so that I can repro the issue

Willis0826 avatar Apr 17 '24 12:04 Willis0826

Any update? I'm facing same issue here

I'm using updateOne() with upsert but not creating new document

rival14 avatar Apr 26 '24 14:04 rival14

@rival14 still nothing, I still have the same problem, for now I have it without soft erasing. @Willis0826 Can you show how you have configured the document schema?

cguilarte avatar Apr 26 '24 16:04 cguilarte

@cguilarte Yes, sure! I tested the functionality using the provided unit test code. You can find the document schema here.

Willis0826 avatar Apr 27 '24 19:04 Willis0826

@cguilarte @rival14 Hi, are you still experiencing this issue?

Willis0826 avatar Jun 17 '24 22:06 Willis0826

I will close this issue for now. Please feel free to reopen the issue if you are still running into this issue.

Willis0826 avatar Jun 20 '24 06:06 Willis0826