-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Update from 8.8.2 to 8.8.3 causes "Uncaught TypeError: Invalid path
. Must be either string or array"
#15071
Comments
We're experiencing the same issue. |
Same here |
Without a repro script there's no way for us to guarantee a fix, but in #15098 we added some logic to improve this error message and a potential (but unlikely) fix. Can anyone in this thread please provide a script that demonstrates this issue or some sample code that can give us some hints? |
fix(document+schema): add potential fix for #15071
Boy, that took a few hours ... Here we go https://github.com/christian-schwaderer/mongoose-8-8-3-invalid-path-demo Edit: The script expects a Mongo instance running on |
@christian-schwaderer the issue is due to the fact that your Is there anything preventing you from upgrading your top-level module to Mongoose 8.8.3? We will see what we can do to fix this particular issue, but it is worth noting that you should keep your Mongoose versions consistent between shared packages, because we don't test that, for example, schemas from Mongoose 8.5 work with models from Mongoose 8.8. |
Still working on a fix, this is a bit tricky because we need to effectively implement two separate $getAllSubdocs(), one for the normal case and one for the "pre 8.8 mongoose Schema, post 8.8 mongoose model" case. |
Prerequisites
Mongoose version
8.8.3
Node.js version
20.18.0
MongoDB server version
7
Typescript version (if applicable)
No response
Description
I tried upgrading Mongoose from 8.8.2 to 8.8.3. But when trying to create a document I got this issue:
Tried to look a little bit and it seems that the problematic line is
for (const { path } of doc.$__schema.childSchemas) {
It seems my schema has a
paths
property but not apath
property and hence anundefined
value is passed down. But that's where my knowledge ends. Cannot say how come.Steps to Reproduce
Sorry but I cannot paste hundreds of lines of company code in here. I have no idea where in my schema the problem is.
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: