Skip to content

Id on nested documents are mapped to _id [DATAMONGO-2496] #3351

Open
@spring-projects-issues

Description

@spring-projects-issues

provirus opened DATAMONGO-2496 and commented

Having the following classes:

@Document
class Parent {
  @Id
  private String id;

  private Child child;

  // Getters and setters
}

class Child {
  private Long id;
  private String name;

  // Getters and setters
}

Spring Data produces the following document:

{
  "_id": ...,
  "child": {
    "_id": 10,
    "name": "Foo"
  }
}

 
The expected document is:

{
  "_id": ...,
  "child": {
    "id": 10,
    "name": "Foo"
  }
}

Since there is no need for id mapping on the child document


Affects: 2.2.5 (Moore SR5)

Issue Links:

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