Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Embedables Array #1699

Closed
kodeine opened this issue Apr 18, 2021 · 2 comments
Closed

Nested Embedables Array #1699

kodeine opened this issue Apr 18, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@kodeine
Copy link

kodeine commented Apr 18, 2021

Describe the bug

model

  @Embedded({ entity: () => TargetExpression, nullable: true, array: true  })
  expression?: TargetExpression[] = [];

DTO

UpdateTargetInput {
  state: 'enabled',
  expression: [
    ProductTargetExpressionInput {
      type: 'someType',
      value: 'asdasdasd'
    }
  ],
  expressionType: 'manual'
}

Works fine and stores as array in mongodb.

const item = repository.create(dto);
wrap(item).assign(dto, { mergeObjects: true });
const item = await repository.findOneOrFail(where);
wrap(item).assign(dto, { mergeObjects: true, updateNestedEntities: true });

converts the dto to so it doesnt store in database.

expression: ProductTargetExpression {
    '0': ProductTargetExpressionInput {
      type: 'asinSameAs',
      value: 'asdasdasd'
    }
  }

Versions

Dependency Version
node ?
typescript ?
mikro-orm ?
your-driver mongodb
@B4nan
Copy link
Member

B4nan commented Apr 18, 2021

Provide actual repro, this is not enough. Where are the entity and embeddables definitions? What version are you on? Dont ignore the issue template. Reproduction needs to be complete and verifiable. I need to see the actual data, you did not even gave me valid code for that.

edit: reproduced, actually both flags should not have any effect on this

@B4nan B4nan added the bug Something isn't working label Apr 18, 2021
B4nan added a commit that referenced this issue Apr 18, 2021
@B4nan B4nan closed this as completed in f02fb75 Apr 18, 2021
@B4nan
Copy link
Member

B4nan commented Apr 18, 2021

4.5.4-dev.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants