Update a document in a collection
put
/_/baas-services/database/{project_id}/v2/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 an array of operations for targeted updates (API version 2), supporting actions like set, delete, arrayUnion, arrayRemove, increment, and servertimestamp. 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 request payload, it ensures optimistic locking. This endpoint requires authentication via Bearer token or AppKey. Payload may include "$embeddings" in document data for BYOV vector fields. For API version 2 operation-array payloads, `set` on `$embeddings` accepts an object keyed by vector column name, `delete` on `$embeddings` accepts an array of embedding keys, and delete semantics perform key-nulling in the request-resource transform; vector apply treats `null` as clear-column (sets VECTOR column to `NULL`).
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