Skip to content

Commit

Permalink
Merge pull request #123 from meilechwieder/patch-1
Browse files Browse the repository at this point in the history
Add more methods that are overridden
  • Loading branch information
dsanel authored Jun 13, 2023
2 parents 281f4e1 + 06fde9c commit a7f2b77
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,20 @@ Pet.restore({age:10}).exec(function (err, result) { ... });

We have the option to override all standard methods or only specific methods. Overridden methods will exclude deleted documents from results, documents that have ```deleted = true```. Every overridden method will have two additional methods, so we will be able to work with deleted documents.

| only not deleted documents | only deleted documents | all documents |
|----------------------------|-------------------------|-----------------------------|
| count() | countDeleted | countWithDeleted |
| countDocuments() | countDocumentsDeleted | countDocumentsWithDeleted |
| find() | findDeleted | findWithDeleted |
| findOne() | findOneDeleted | findOneWithDeleted |
| findOneAndUpdate() | findOneAndUpdateDeleted | findOneAndUpdateWithDeleted |
| update() | updateDeleted | updateWithDeleted |
| updateOne() | updateOneDeleted | updateOneWithDeleted |
| updateMany() | updateManyDeleted | updateManyWithDeleted |
| aggregate() | aggregateDeleted | aggregateWithDeleted |
| only not deleted documents | only deleted documents | all documents |
|----------------------------|------------------------------------|----------------------------------------|
| count() | countDeleted | countWithDeleted |
| countDocuments() | countDocumentsDeleted | countDocumentsWithDeleted |
| find() | findDeleted | findWithDeleted |
| findOne() | findOneDeleted | findOneWithDeleted |
| findOneAndUpdate() | findOneAndUpdateDeleted | findOneAndUpdateWithDeleted |
| update() | updateDeleted | updateWithDeleted |
| updateOne() | updateOneDeleted | updateOneWithDeleted |
| updateMany() | updateManyDeleted | updateManyWithDeleted |
| aggregate() | aggregateDeleted | aggregateWithDeleted |
| findById() | Please use findOne | Please use findOneWithDeleted |
| findByIdAndUpdate() | Please use findOneAndUpdateDeleted | Please use findOneAndUpdateWithDeleted |


### Examples how to override one or multiple methods

Expand Down

0 comments on commit a7f2b77

Please sign in to comment.