Get Single Document
GET/collections/:collectionName/documents/:docId
Query a single document by its _id. Supports field projection and in-transaction queries. Returns 404 if the document does not exist.
Request
Path Parameters
collectionName stringrequired
Collection name
docId stringrequired
Document ID (supports both ObjectId strings and plain strings)
Query Parameters
projection string
Field projection (JSON string), e.g. {"name":1,"email":1}
transactionId string
Transaction ID
Responses
- 200
- 404
Query successful
- application/json
- Schema
- Example (from schema)
- Example
Schema
object
{}
{
"_id": {
"$oid": "507f1f77bcf86cd799439011"
},
"name": "John Doe",
"age": {
"$numberInt": "30"
},
"email": "john@example.com"
}
Document not found
- application/json
- Schema
- Example (from schema)
- Example
Schema
code string
Error code
message string
Error message
request_id string
Unique request ID
{
"code": "INVALID_PARAM",
"message": "param.query can't be empty",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
{
"code": "DOCUMENT_NOT_FOUND",
"message": "Document not found",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Loading...