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
Cannot set strictQuery: false globally and have an embedded discriminator #12796
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Comments
A hacky workaround is to add |
Update to latest and see if that resolves your issue const mongoose = require('mongoose');
const testSchema = new mongoose.Schema({
test: [{foo: String}]
});
testSchema.path("test").discriminator("Bar", new mongoose.Schema({ bar: String }));
console.log('done'); |
IslandRhythms
added
the
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
label
Dec 19, 2022
Issue is still there on latest. You need to add const mongoose = require('mongoose');
mongoose.set("strictQuery", false);
const testSchema = new mongoose.Schema({
test: [{foo: String}]
});
testSchema.path("test").discriminator("Bar", new mongoose.Schema({ bar: String }));
console.log('done'); |
const mongoose = require('mongoose');
mongoose.set('strictQuery', false);
const testSchema = new mongoose.Schema({
test: [{foo: String}]
});
testSchema.path("test").discriminator("Bar", new mongoose.Schema({ bar: String }));
console.log('done'); |
IslandRhythms
added
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
and removed
can't reproduce
Mongoose devs have been unable to reproduce this issue. Close after 14 days of inactivity.
labels
Dec 19, 2022
vkarpov15
added a commit
that referenced
this issue
Dec 23, 2022
…embedded discriminators Fix #12796
vkarpov15
added a commit
that referenced
this issue
Dec 26, 2022
fix(schema): propagate strictQuery to implicitly created schemas for embedded discriminators
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
6.8.0
Node.js version
16.17.1
MongoDB server version
4.4
Typescript version (if applicable)
No response
Description
Running the following code:
Fails with:
Steps to Reproduce
See above
Expected Behavior
I should be able to set
strictQuery: false
globally, but I can't because something about this implementation is broken with schemas that create embedded array discriminators.The text was updated successfully, but these errors were encountered: