e-oj / Fawn

Transactions for MongoDB (See the README)
https://www.npmjs.com/package/fawn
MIT License
485 stars 54 forks source link

Can Fawn support soft delete? #26

Closed zhengyhn closed 7 years ago

zhengyhn commented 7 years ago

Hi, We don't have permission to remove records in production, can Fawn support soft delete? For example, use this package mongoose-delete.

e-oj commented 7 years ago

I'll say no, but that's just because implementations for soft delete are very subjective. You could just add a boolean "deleted" field and update it with the update method.

So instead of

task.remove("things", {_id: someId})

you could do

task.update("things", {_id: someId}, {deleted: true})