Skip to content
This repository was archived by the owner on Aug 22, 2019. It is now read-only.
This repository was archived by the owner on Aug 22, 2019. It is now read-only.

Saving changes on arrays of references does nothing #1

Description

@jakubhomoly

There is a bug right now in the master branch with saving changes to an array of references.

Example:

const CarSchema = new Schema('Car', {
    brand: Type.string(),
    topSpeed: Type.number(),
    taxPaid: Type.boolean(),
    wheels: Type.array(Type.object({
      wheelType: Type.reference(Wheel)
    }))
  })

const Car = settee.buildModel(CarSchema)

settee.registerModels([Car, Wheel])

let bmw = await Car.create({
    brand: 'BMW'
})

bmw.wheels = [
    { wheelType: michelinWheel },
    { wheelType: bridgestoneWheel }
  ]

await bmw.save()

The save() does not store the changes, since this functionality was not completely tested.

With this in mind, we have drafted a fix for this issue in this branch. We will be testing it out for approximately a week, and if everything works out okay, we will merge it with the master branch and create a new release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions