Skip to content
This repository was archived by the owner on Jun 19, 2023. It is now read-only.

onMissing option doesn't work with nested objects #206

@trevore-q4

Description

@trevore-q4

I have an object like:

class Metadata {
  @attribute()
  valueA?: string;

  @attribute()
  valueB?: string;
}

@table("documents")
class Document {
  @hashKey()
  key: string;

  @attribute({ memberType: embed(Metadata) })
  metadata: Metadata;
}

Using DataMapper.update with the onMissing option set to skip, if I try to update a single property in the nested object, all missing properties are removed, not skipped as the option would suggest.

Sample code:

const doc = new Document();
doc.key = "<hashKey>";
doc.metadata = new Metadata();
doc.metadata.valueB = "new value";
const dataMapper = new DataMapper();
dataMapper.update(doc, { onMissing: 'skip' });

Result is that valueA gets stripped from the document.

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