SeparateEntityId

Separating entities ids.

The @SeparateEntityId annotation is used to generate a separate MongoDB ObjectID for each entity of the repository. If @SeparateEntityId is not used, the @Id field is converted to the _id of the MongoDB document and used as a unique index.

Example Usage of @SeparateEntityId:

@Collection("customer_repository")
@SeparateEntityId
public interface CustomerRepository extends Repository<Customer, UUID> {
}
A document without @SeparateEntityId
A document with @SeparateEntityId

Last updated