Automattic / Automattic/mongoose

Feature: Soft-Delete

Open
#7,304 12 comments 4 reactions 0 assignees View on GitHub
plugin
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

**Do you want to request a *feature* or report a *bug*?**
feature

**What is the current behavior?**
Deleting a document in mongoose really deletes it from the database.

**What is the expected behavior?**
We should be able to enable an option to let documents be "soft-deleted". Meaning, there should be an attribute like `_deleted` on each document and deleting a document by the normal mongoose way will jsut mark the document as deleted. Find-queries will, by default, all skip/exclude documents that are marked as "deleted". By options, one can still hard-delete documents or find-query including or only deleted documents.
There are 2-3 plugins for that but they are not maintained in any way, nor do they have a considerable amount of downloads and their last commit is over 3 years old.
I, and many others that will be working with mongoose in professional environments, will love that feature.

**Please mention your node.js, mongoose and MongoDB version.**
All latest versions

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are identified in the issue. Start by reviewing the requested soft-delete behavior and its options for deleting and finding documents; done would require an agreed design and corresponding implementation across those operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb, node.js
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.