Skip to content

Refine @DocumentReference documentation about self._id references #4925

Closed
@rfelgent

Description

@rfelgent

Hello,

according to documentation this works

@Document
class Book {

  @Id
  ObjectId id;
  String title;
  ObjectId publisherId;
}

@Document
class Publisher {

  @Id
  ObjectId id;
  String acronym;
  String name;

  @ReadOnlyProperty
  @DocumentReference(lookup="{'publisherId':?#{#self._id} }")
  List<Book> books;
}

I tried to change the data type from ObjectId to String and it does not work.

@Document
class Book {

  @Id
  String id;
  String title;
  String publisherId;
}

@Document
class Publisher {

  @Id
  String id;
  String acronym;
  String name;

  @ReadOnlyProperty
  @DocumentReference(lookup="{'publisherId':?#{#self._id} }")
  List<Book> books;
}

What am I missing ?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions