Update a document in a collection
put
/_/baas-services/database/{project_id}/v1/updateDocument
This service updates an existing document in a specified collection and returns the OID (Object Identifier) of the updated document upon successful operation. The update requires specifying the document's path and the data fields to modify. For collection-based updates, provide the path as an array alternating between collection names and document IDs (e.g., ['users', 'user123']). The 'data' field can be a direct object for replacement (API version 1). For duality view updates, specify the view name ('dv_name'), the document OID, and the data object to update. If a version is provided in the payload, it ensures optimistic locking. This endpoint requires authentication via Bearer token or AppKey.
Request
Path Parameters
-
project_id(required):
Specifies a unique Project ID, associated with the fusabase Project
Header Parameters
-
x-transaction(required):
Used for facilitating transactions
Response
200 Response
Returns OID of the updated document
401 Response
Authentication Failure
Default Response
Error