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

findOneAndModify deprecation still showing in logs #7865

Closed
Martii opened this issue Jun 4, 2019 · 4 comments
Closed

findOneAndModify deprecation still showing in logs #7865

Martii opened this issue Jun 4, 2019 · 4 comments

Comments

@Martii
Copy link

Martii commented Jun 4, 2019

Do you want to request a feature or report a bug?
Possibly a bug.

What is the current behavior?

Still shows deprecation in logs:

2019-06-04 03:06:37.492 +00:00: (node:2962) DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `useFindAndModify` option set to false are deprecated. See: https://mongoosejs.com/docs/deprecations.html#-findandmodify-

If the current behavior is a bug, please provide the steps to reproduce.

  1. Read this... https://mongoosejs.com/docs/deprecations.html#-findandmodify- ...
  2. Centered on this usage:

You can also configure useFindAndModify by passing it through the connection options. mongoose.connect(uri, { useFindAndModify: false });

  1. Modified this about six days ago which gets loaded here.

What is the expected behavior?

If you use Model.findOneAndUpdate(), by default you'll see one of the below deprecation warnings.

Perhaps we shouldn't be seeing the deprecation warning anymore based off the inverse of this sentence. e.g. Since we changed to useFindAndModify: false should we not be seeing this deprecation notice anymore?

I realize we can, and have been, ignore the deprecation warning but I thought it was squashed yet it still shows up. We could also just split out the usage since it's used exactly, and only, in one place in our source... however any assistance/investigation would be appreciated.

What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.

$ node -v
v12.3.1

MongoDB 4.0.9 & 4.0.10 via mongodb@3.2.6 and mongoose@5.5.11 / mongoose@5.5.12

@Fonger
Copy link
Contributor

Fonger commented Jun 5, 2019

Not sure if it's related but note that your useFindAndModify is not set when isPro is true.

! if (isPro) {
  dbOptions = {
    useNewUrlParser: true,
    secondaryAcceptableLatencyMS: 15,
    poolSize: defaultPoolSize,
    socketTimeoutMS: 90000 // Mitigation of #1548
+   useFindAndModify: false
  }
! } else {
  dbOptions = {
    useNewUrlParser: true,
    poolSize: defaultPoolSize,
    reconnectTries: 30,
    reconnectInterval: 1000,

    useFindAndModify: false // #1516
  }
!}

@Martii
Copy link
Author

Martii commented Jun 5, 2019

🤦‍♂️ That's most likely it... will upload and close on success. I must have had a really bad day that day to miss that conditional.

@Martii
Copy link
Author

Martii commented Jun 5, 2019

A few bad days I guess... sorry for the issue and thank you for the helpful assistance. I'm going to go hide for a while. LOL. 😸

@Martii Martii closed this as completed Jun 5, 2019
@vkarpov15
Copy link
Collaborator

Thanks for finding this @Fonger 👍

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

3 participants