Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript: MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" #12329

Closed
2 tasks done
Jule- opened this issue Aug 25, 2022 · 1 comment
Closed
2 tasks done
Milestone

Comments

@Jule-
Copy link

Jule- commented Aug 25, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

6.5.3

Node.js version

x

MongoDB server version

x

Description

The documentation expose query middlewares findOneAndReplace() and replaceOne() while types are not allowing using the string findOneAndReplace and replaceOne as first parameter of schema.pre(...)

Steps to Reproduce

https://codesandbox.io/s/beautiful-mclaren-zos0cn?file=/src/index.ts

import { Schema } from "mongoose";

const schema = new Schema({});
schema.pre("findOneAndReplace", function() {});
schema.pre("replaceOne", function() {});

Expected Behavior

No typescript error.

@Jule-
Copy link
Author

Jule- commented Aug 25, 2022

It seems that replaceOne is also missing.

@Jule- Jule- changed the title Typescript: MongooseQueryMiddleware missing "findOneAndReplace" Typescript: MongooseQueryMiddleware missing "findOneAndReplace" and "replaceOne" Aug 25, 2022
lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Aug 25, 2022
lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Aug 25, 2022
@AbdelrahmanHafez AbdelrahmanHafez added this to the 6.5.4 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants