Skip to content

fix: support mongoose v9 embeddedSchemaType instead of caster#119

Open
loresclement wants to merge 1 commit intoSoftwareBrothers:masterfrom
loresclement:fix/mongoose-9-compat
Open

fix: support mongoose v9 embeddedSchemaType instead of caster#119
loresclement wants to merge 1 commit intoSoftwareBrothers:masterfrom
loresclement:fix/mongoose-9-compat

Conversation

@loresclement
Copy link

Mongoose v9 removed SchemaType.caster. This causes AdminJS to crash when handling arrays of subdocuments.
This PR adds backward-compatible support for both:

Mongoose <= 8 using caster

Mongoose 9+ using embeddedSchemaType / fallbacks

Fixes runtime error:
TypeError: Cannot destructure property 'instance' of 'this.mongoosePath.caster' as it is undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant