Skip to content

Unhandled exception occur when trying to update document #15642

@KhaledMosaad

Description

@KhaledMosaad

Prerequisites

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

Mongoose version

8.18.2

Node.js version

22.12

MongoDB server version

8.0

Typescript version (if applicable)

No response

Description

I have an issue when try to update a document with reach embedded documents, the stack trace of the error is:

TypeError: Cannot read properties of undefined (reading 'split')
    at Schema.hasMixedParent (/app/node_modules/mongoose/lib/schema.js:1934:25)
    at Schema.path (/app/node_modules/mongoose/lib/schema.js:1233:23)
    at Schema._getSchema (/app/node_modules/mongoose/lib/schema.js:2876:28)
    at walkUpdatePath (/app/node_modules/mongoose/lib/helpers/query/castUpdate.js:384:27)
    at castUpdate (/app/node_modules/mongoose/lib/helpers/query/castUpdate.js:144:7)
    at model.Query._castUpdate (/app/node_modules/mongoose/lib/query.js:4874:10)
    at model.Query._updateThunk (/app/node_modules/mongoose/lib/query.js:4062:25)
    at model.Query._updateOne (/app/node_modules/mongoose/lib/query.js:4150:23)
    at model.Query.exec (/app/node_modules/mongoose/lib/query.js:4627:80)
    at processTicksAndRejections (node:internal/process/task_queues:105:5)
    at Object.updateSettings (file:///app/src/modules/assessments/assessments/services/assessments.js:843:9)
    at updateSettings (file:///app/src/modules/assessments/assessments/controller/index.js:73:7)

Steps to Reproduce

I can't reproduce it systematically

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions