findOne method

Future<Object?> findOne({
  1. required Object collectionName,
  2. required Object id,
  3. Map<String, Object?>? query,
  4. bool? expandReferences,
  5. Map<String, String>? headers,
})

GET /{version}/database/collections/{collectionName}/{id}

expandReferences — set true to get every reference value as { id, display } (see ExpandedReference); left unset, the stored ids come back as before. Needs read permission on every source the schema links to, else the read is refused with CM-ERRORS-DATABASE-056.

Implementation

Future<Object?> findOne(
    {required Object collectionName,
    required Object id,
    Map<String, Object?>? query,
    bool? expandReferences,
    Map<String, String>? headers}) {
  return transport.send(
    route: '/{version}/database/collections/{collectionName}/{id}',
    method: 'GET',
    query: withExpandReferences(query, expandReferences),
    headers: headers,
    pathParams: <String, Object?>{'collectionName': collectionName, 'id': id},
  );
}