Description
BUG
{ "name": "TypeError", "message": "Cannot read property 'split' of undefined", "stack": "TypeError: Cannot read property 'split' of undefined\n at SingleNested.Subdocument.isModified (/home/node/app/ne-route-droker-api/node_modules/mongoose/lib/types/subdocument.js:120:51)\n at SingleNested.<anonymous> (/home/node/app/ne-route-droker-api/node_modules/mongoose/lib/schema.js:1113:60)\n at callMiddlewareFunction (/home/node/app/ne-route-droker-api/node_modules/kareem/index.js:482:23)\n at SingleNested.next (/home/node/app/ne-route-droker-api/node_modules/kareem/index.js:58:7)\n at _next (/home/node/app/ne-route-droker-api/node_modules/kareem/index.js:106:10)\n at process.nextTick (/home/node/app/ne-route-droker-api/node_modules/kareem/index.js:507:38)\n at process._tickCallback (internal/process/next_tick.js:61:11)" }
My code was working like a charm and I update from 5.7.1 to 5.7.5 and suddenly this error start happening. I did not write any change in my code. I revert to version 5.7.1 and everything works again.
I built a Docker Image over Ubuntu 16.04.
Mongo 4.1
Node 10 LTS
Mongoose version 5.7.5
Activity
Youssefares commentedon Oct 16, 2019
This is happening in my system as well. Has to do with #8223
It occurs when saving any record for me (at least records with a subdocument).
BastienScanu commentedon Oct 17, 2019
I got the same problem, upgrading from v5.6.11 to 5.7.5. Every time I try to save a document in one of my collections I get this error, but other collections work just fine. The problematic collection has subdocuments. I fixed my problem by going back to v5.6.11.
saveman71 commentedon Oct 17, 2019
Same here, here is a repro:
I initially thought it was due to the timestamp option but it appears this is more generalIt seems to work if I disable the timestamps option. Please tell me if that's another bug!Works fine in 5.7.4, makes sense since the code was introduced in 327b47a
stieg commentedon Oct 18, 2019
Error for me stems from lib/schema.js:1113 where
this.isModified()
is called without arguments. However it seems that theisModified
function expects 2 arguments:paths
&modifiedPaths
. Hence the error. Regression seems to have been introduced in 5.7.5 as 5.7.4 works finetest(document): repro #8251
vkarpov15 commentedon Oct 18, 2019
Thanks for the repro script and sorry for the trouble, the fix will be in 5.7.6 👍
saveman71 commentedon Oct 20, 2019
Thanks for the quick fix and thanks for being this reactive!
carolinevk8 commentedon Oct 12, 2022
I got the same problem. Is it a bug? If not then can you share the solution
saveman71 commentedon Oct 12, 2022
If you're before 5.7.6 then upgrade (the fix is there) otherwise open a new issue!
3 remaining items