Comments (2)
type issue also visible when adding test to middleware.test.ts
schema.pre<Query<ITest, ITest> | Model<ITest>>(['deleteOne', 'deleteMany', 'findOneAndDelete', 'findOneAndRemove'], {query: true, document: true}, function (this, next) {
expectType<Model<ITest> | Query<ITest, ITest>>(this);
next();
});
from mongoose.
It looks like the cause of this issue is the 'findOneAndRemove'
. findOneAndRemove()
was removed in Mongoose 8, and our TypeScript types removed it. It looks like the following compiles fine with Mongoose 8.1.0:
schema.pre<Query<ITest, ITest> | Model<ITest>>(
['deleteOne', 'deleteMany', 'findOneAndDelete'],
{query: true, document: true},
function (this, next) {
expectType<Model<ITest> | Query<ITest, ITest>>(this);
next();
}
);
from mongoose.
Related Issues (20)
- Document.toObject() does not apply to subdocuments HOT 1
- Pre validate: is not triggert on all sub documents when set via _.set() with a nested path HOT 1
- Using mongoose and got error when adding new data: Product validation failed HOT 1
- Discriminators: Return derived model when issuing Find on base model HOT 1
- When updating elements of primitive array using positional filtered operator, update value is incorrectly cast to array
- empty objects are being saved as null HOT 1
- Autoindex is recreating existing indexes HOT 2
- StrictPopulateError: Cannot populate path `totalLinksList` because it is not in your schema. Set the `strictPopulate` option to false to override. HOT 1
- Breaking types of `toObject` on SubDocument or ArraySubdocument HOT 1
- Make autoIndex syncIndex instead of createIndex
- Using Promise.all inside transactions errors with "Cannot pin multiple connections to the same session" HOT 6
- new Types.ObjectId is deprecated how do i convert a string _id to an ObjectID now? HOT 1
- Filter is mutated in place by Query modifiers
- command events are not fired after setting monitorCommands: true HOT 2
- log : import_mongoose.default.connect is not a function
- Type is incorrect for Query.distinct when field is a nested field HOT 1
- Not Work `new mongoose.Types.ObjectId` HOT 1
- Default values sometimes do not work when creating a document
- Populate does not consider toJSON and id:true HOT 1
- Bulk operations not including shardKey
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongoose.