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

Add deprecation warning for default strictQuery #12666

Closed
2 tasks done
vkarpov15 opened this issue Nov 7, 2022 · 4 comments · Fixed by #12675
Closed
2 tasks done

Add deprecation warning for default strictQuery #12666

vkarpov15 opened this issue Nov 7, 2022 · 4 comments · Fixed by #12675
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone

Comments

@vkarpov15
Copy link
Collaborator

Prerequisites

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

Issue

We're planning on switching strictQuery back to false in Mongoose 7, see #11861. We should add a deprecation warning to encourage devs to add mongoose.set('strictQuery', false) in their projects to prepare for this change.

@vkarpov15 vkarpov15 added this to the 6.8 milestone Nov 7, 2022
@hasezoey hasezoey added the enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature label Nov 8, 2022
@lpizzinidev
Copy link
Contributor

lpizzinidev commented Nov 8, 2022

@vkarpov15 @hasezoey
When should the warning be displayed?
On database connection?

@hasezoey
Copy link
Collaborator

hasezoey commented Nov 8, 2022

When should the warning be displayed?

i would guess under the following conditions:
on query or on connection if strictQuery is not manually set and maybe only if it would affect the query by having it true

lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Nov 10, 2022
lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Nov 13, 2022
lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Nov 14, 2022
@vkarpov15
Copy link
Collaborator Author

I think only on database connection. We're changing the default global option, so printing a warning if strictQuery isn't set on a query doesn't seem like the way to go.

lpizzinidev added a commit to lpizzinidev/mongoose that referenced this issue Nov 24, 2022
vkarpov15 added a commit that referenced this issue Nov 26, 2022
added deprecation warning for default `strictQuery`
@mohit4bug
Copy link

mohit4bug commented Dec 8, 2022

import mongoose from "mongoose";


// ADD THIS IS YOUR CONNECTION FILE
mongoose.set('strictQuery', true);

// CONNECTION
mongoose.connect("mongodb://0.0.0.0:27017/<dbname>", {
    useNewUrlParser: true,
    useUnifiedTopology: true,
}).then(console.log("connected to db!"))
    .catch(e => console.log(e))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants