question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marshallswaincommented, Aug 19, 2016

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.

import softDelete from 'feathers-mongoose/hooks/soft-delete';
app.service('/v1/messages').before({
   remove: [
      softDelete({
         fieldName: 'isDeleted',
         deletedBy: true
      })
   ]
});
0reactions
prashantnirguncommented, Jul 11, 2021

This also is broken link

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found