DynamicModel creates a new dynamic model with fields from the provided data shape.

Caveats:

  • In order to use 0 as double/float initialization number you have to negate it (-0).
  • You need to use lowerCamelCase when accessing the model fields (e.g. model.roles and not model.Roles).

Example:

const model = new DynamicModel({
name: ""
age: 0, // int64
totalSpent: -0, // float64
active: false,
Roles: [], // maps to "Roles" in the DB/JSON but the prop would be accessible via "model.roles"
meta: {}
})

Hierarchy

  • DynamicModel

Constructors

Constructors

Generated using TypeDoc