updateDocument method
Update Document
Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
Implementation
Future<req.Response> updateDocument(
{required String collectionId,
required String documentId,
required Map data,
List? read,
List? write}) {
final String path =
'/database/collections/{collectionId}/documents/{documentId}'
.replaceAll(RegExp('{collectionId}'), collectionId)
.replaceAll(RegExp('{documentId}'), documentId);
final Map<String, dynamic> params = {
'data': data,
'read': read,
'write': write,
};
final Map<String, String> headers = {
'content-type': 'application/json',
};
return client.call(HttpMethod.patch,
path: path, params: params, headers: headers);
}