Nested Discriminators in multi-dimensonal arrays use name
instead of value
#13201
Closed
2 tasks done
Labels
confirmed-bug
We've confirmed this is a bug in Mongoose and will fix it.
Milestone
Prerequisites
Mongoose version
6.10.1
Node.js version
19.6.0
MongoDB server version
5.0
Typescript version (if applicable)
4.9.5
Description
I have noticed that nested discriminator multi-dimensonal arrays use the
name
of the discriminator instead ofvalue
, like in non-array or one-dimensonal arraysfunction parameter reference:
path.discriminator(name, schema, value)
Steps to Reproduce
Reproduction Repository & branch: https://github.com/typegoose/typegoose-testing/tree/mongooseNestedDiscriminatorNaming
(have node_modules install and a mongo instance running on default port)
execute
yarn run run
(or any package manager)observe output being without the discriminated properties and assert error
invert https://github.com/typegoose/typegoose-testing/blob/39da16a7de48d26f9d37b1ead010c0d7f48ce6ec/src/test.ts#L83-L88
execute
yarn run run
(or any package manager)observe discriminated properties being present and no assertion error
also includes commented-out code for a one-dimensonal array
Expected Behavior
to use
value
like for one-dimensonal arrays and non-arraysalso tested mongoose 7.0.2, with same behavior
The text was updated successfully, but these errors were encountered: