Giter Club home page Giter Club logo

mongoose-softdelete's Introduction

1x-badge

Top Langs

mongoose-softdelete's People

Contributors

dependabot[bot] avatar madeindjs avatar riyadhalnur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mongoose-softdelete's Issues

Does this exclude soft deleted documents from queries?

Looking through the docs, It doesnt look like it, but I thought id make sure. Usually the soft deletes or 'paranoid' setting will exclude the soft deleted documents from future queries, until they are restored. Is that possible with this plugin?

Unknown types

node_modules/mongoose-softdelete/index.d.ts:1:42 - error TS2305: Module '"mongoose"' has no exported member 'DocumentQuery'.

1 import { Document, Model, Query, Schema, DocumentQuery } from "mongoose";
                                           ~~~~~~~~~~~~~

node_modules/mongoose-softdelete/index.d.ts:15:38 - error TS2314: Generic type 'Query<ResultType, DocType>' requires 2 type argument(s).

15   isDeleted: (condition: Boolean) => Query<ISoftDeletedDocument>;
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/mongoose-softdelete/index.d.ts:18:33 - error TS2314: Generic type 'Query<ResultType, DocType>' requires 2 type argument(s).

18 export type ISoftDeletedQuery = Query<ISoftDeletedDocument> & IQueryMethods;
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~

[3:54:37 PM] Found 3 errors. Watching for file changes.

mongoose validating before softdelete

I think your softdelete system is based on deleted field, but when i softdeleting, mongoose validating, and document not soft deleted. Can you help me? any config that i miss or this is a bug. Thank you before.

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module

Hi im trying to use soft delete with typescript


Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/globant/Documents/repos/spybee/node_modules/mongoose-softdelete/src/mongoose-softdelete.js
require() of ES modules is not supported.
require() of /home/globant/Documents/repos/spybee/node_modules/mongoose-softdelete/src/mongoose-softdelete.js from /home/globant/Documents/repos/spybee/src/models/user.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename mongoose-softdelete.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/globant/Documents/repos/spybee/node_modules/mongoose-softdelete/package.json.



Package.json


{
  "name": "spybee",
  "version": "1.0.0",
  "description": "Spybee backend",
  "main": "app.js",
  "scripts": {
    "clean": "rm -r -f ./build",
    "tsc": "tsc",
    "test": "echo \"Error: no test specified\" && exit 1",
    "start:dev": "nodemon",
    "start:local": "ts-node ./src/server.ts",
    "build": "tsc -p tsconfig.json",
    "add-develop": "git remote add develop https://git.heroku.com/spybee-api.git",
    "push-develop": "git push develop develop:master",
    "start": "node ./build/src/server.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@sendgrid/mail": "^7.4.2",
    "@types/bcrypt": "^3.0.0",
    "@types/cors": "^2.8.9",
    "@types/express": "^4.17.11",
    "@types/mongoose": "^5.10.3",
    "bcrypt": "^5.0.0",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "eslint": "^5.15.3",
    "eslint-config-prettier": "^4.1.0",
    "eslint-plugin-jest": "^22.3.0",
    "eslint-plugin-prettier": "^3.0.1",
    "eslint-plugin-simple-import-sort": "^4.0.0",
    "express": "^4.17.1",
    "joi": "^17.3.0",
    "jsonwebtoken": "^8.5.1",
    "mongoose": "^5.11.12",
    "mongoose-softdelete": "^1.2.0",
    "nodemon": "^2.0.7",
    "ts-node": "^8.0.3",
    "typescript": "^4.1.3"
  },
  "devDependencies": {
    "@types/jsonwebtoken": "^8.5.0",
    "@typescript-eslint/eslint-plugin": "^1.4.2",
    "@typescript-eslint/parser": "^1.4.2"
  }
}

Plans on releasing a TypeScript type?

Hi, everything is in the question:

Are there any plans on doing a TypeScript definition? Would be amazing to have the autocompletion features and validation.

Thanks for any information :)
Tom

ERR_REQUIRE_ESM on running project

I have imported the package as instructed as follows:
const softDelete = require('mongoose-softdelete');
But whenever I'm running the project, I'm facing an error like below:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/subhasis/Work/mpac-dispenser/node_modules/mongoose-softdelete/src/mongoose-softdelete.js require() of ES modules is not supported. require() of /home/subhasis/Work/mpac-dispenser/node_modules/mongoose-softdelete/src/mongoose-softdelete.js from /home/subhasis/Work/mpac-dispenser/models/medicine.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename mongoose-softdelete.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/subhasis/Work/mpac-dispenser/node_modules/mongoose-softdelete/package.json.
Kindly fix this issue otherwise give a solution to overcome this. If I comment out the require line then it runs fine.

View soft deleted objects in the database.

I've tried out this plugin and noticed when I perform a soft delete I can no longer find it in the database.

Is this expected behaviour?

How do you restore an object if you are unable to find it again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.