Skip to content

Error when specifying the Array type #47

@blasdfaa

Description

@blasdfaa

const userSchema = mongoose.Schema({ movies_ids: Array })
When specifying the field as "Array", I get this error:

const arraySchema = Array.isArray(value) ? value[0] : value.type[0];
                                                                ^
TypeError: Cannot read properties of undefined (reading '0')

But if you specify so, then everything works
const userSchema = mongoose.Schema({ movies_ids: [] })

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