Skip to content

What is the right way to extend a schema? #121

@jesobreira

Description

@jesobreira

I'm trying to figure out how to 'extend' a schema (i.e. create a schema that inherits properties from a parent schema).

This is how I'm doing it:

const Vehicle = new Schema({
  color: String
})

const Car = new Schema({
   ...Vehicle.props,
   licensePlate: String
})

Is this the right way to do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions