Skip to content

Creating array discriminators only takes two parameters? #8164

Closed
@chaeron

Description

@chaeron

When you create an array discriminator, you do something like this:

var Clicked = docArray.discriminator('Clicked', clickedSchema);

But if you do a model discriminator you can add a third parameter to specify the discriminator key value:

var Clicked = Event.discriminator('Clicked', clickedSchema, "clicked");

Just wondering why we can't use a 3rd discriminator key parameter when we use array discriminators? I'm assuming the first parameter is still the model name, so it would be nice to have the ability to specify the key value if you want it to be different from the Model name.

Thanks!

Activity

vkarpov15

vkarpov15 commented on Sep 19, 2019

@vkarpov15
Collaborator

Good suggestion, will fix.

added this to the 5.7.2 milestone on Sep 19, 2019
added
enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature
on Sep 23, 2019
chaeron

chaeron commented on Sep 26, 2019

@chaeron
Author

You going to update the documentation as well? ;-)

vkarpov15

vkarpov15 commented on Oct 1, 2019

@vkarpov15
Collaborator

I don't think we have docs for this yet, but that's definitely something to add for the future

added
docsThis issue is due to a mistake or omission in the mongoosejs.com documentation
and removed
enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature
on Oct 1, 2019

14 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis issue is due to a mistake or omission in the mongoosejs.com documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chaeron@vkarpov15

        Issue actions

          Creating array discriminators only takes two parameters? · Issue #8164 · Automattic/mongoose