Soft Delete
See original GitHub issueIt would be nice to have a built in soft-delete.
Here is some inspiration: https://github.com/dsanel/mongoose-delete
Ideally, you would be able to pass in options:
app.use('messages', service({,
Model: Message,
paginate: {
default: 2,
max: 4
},
softDelete: {
fieldName: 'isDeleted',
deletedBy: true
}
}));
Example service usage:
app.service('/messages').remove(null, { query: { text: 'foo' }, deletedBy: myUserId });
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (8 by maintainers)
Top Results From Across the Web
What Are Soft Deletes, and How Are They Implemented?
With the soft delete design pattern, you add a bit column like IsDeleted, IsActive, or IsArchived to the table, and instead of deleting...
Read more >To Delete or to Soft Delete, That is the Question! - Jmix
Soft deletion is a widely used pattern applied for business applications. It allows you to mark some records as deleted without actual erasure...
Read more >Soft Deletion Probably Isn't Worth It — brandur.org
Soft Deletion Probably Isn't Worth It. Contents. Downsides: Code leakage. Losing foreign keys; Pruning data is hard; Does undelete really work?
Read more >Are soft deletes a good idea? [duplicate] - Stack Overflow
I say it's a bad idea, generally (with some exceptions, perhaps). First, your database should be backed up regularly, so you should never...
Read more >Soft delete for blobs - Azure Storage | Microsoft Learn
After the retention period has expired, the object is permanently deleted. Recommended data protection configuration. Blob soft delete is part ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @jeremyjs. This is something that you would want to implement as a hook. It’s actually way simple to implement: https://github.com/feathersjs/feathers-mongoose/issues/76#issuecomment-210863012
I think it wouldn’t hurt to have a bundled hook for this that allows for passing the options you specified, though. Actually, it would be handy.
This also is broken link