dsanel / mongoose-delete

Mongoose Soft Delete Plugin
MIT License
346 stars 101 forks source link

findDeleted doesn't apply `{deleted: true}` #98

Closed ahmedmagdy11 closed 3 years ago

ahmedmagdy11 commented 3 years ago

i have no problem that findDeleted return both deleted and non-deleted data, but at least allow me to apply {deleted : true} filter also appreciate your work Thanks for this cool package

LinkedForest commented 3 years ago

Same With me

cthanh2310 commented 3 years ago

i used findDeleted but result was find all documents in DB :(( anyone help me

ahmedmagdy11 commented 3 years ago

@cthanh2310 I think most of the use cases for findDeleted will be in requests that don't need to be optimized aka (sped-up) so you can results.filter(doc => return doc.deleted;)

cthanh2310 commented 3 years ago

Omg tks very much ! i fixed bug .With a newbie as me, I'm so happy <3. But i see video https://www.youtube.com/watch?v=dstdrBsf7ag&list=PL_-VfJajZj0VatBpaXkEHK_UPHL7dW6I3&index=32 in 29:06 it's no problem @@

hieuday93 commented 3 years ago

Omg tks very much ! i fixed bug .With a newbie as me, I'm so happy <3. But i see video https://www.youtube.com/watch?v=dstdrBsf7ag&list=PL_-VfJajZj0VatBpaXkEHK_UPHL7dW6I3&index=32 in 29:06 it's no problem @@

@cthanh2310 In this video, all records had already been deleted so all documents in DB had the field 'deleted' set to be true and it still worked. However, if some records are never be deleted, they will not have the field 'deleted' in DB. mongoose-delete use $ne operator when calling findDeleted, so if some records do not have the field 'deleted' (marked as they are not deleted), they are still be included in the result of this function.

thaoha0302 commented 6 months ago

replace findDeleted({}) to findWithDeleted({deleted:true})

Hoanghaine commented 2 months ago

replace findDeleted({}) to findWithDeleted({deleted:true})

oh thank you so much it's work with me

ChauNhan0201 commented 2 months ago

replace findDeleted({}) to findWithDeleted({deleted:true})

it's work correctly, but i don't understand why findDeleted doesn't work the same way as it does in this video, https://www.youtube.com/watch?v=dstdrBsf7ag&list=PL_-VfJajZj0VatBpaXkEHK_UPHL7dW6I3&index=30