Database Management
Run Simple and Compound Queries on a Collection
Run Simple and Compound Queries on a Collection. You can run a simple WHERE query or a compound AND or OR query on a Collection. This is useful when you want to fetch a specific Document from a Collection and perform some operations on it. You can also sort the response in a specific order of asc or desc on the basis of the Field/Key that you pass in and limit the number of Documents that you want to fetch.
post/api/collections/data/fetch/query
Request body
Example request
{
"collection": "Users",
"queries": [
{
"field": "name",
"operator": "equal to",
"value": "Alex"
},
{
"field": "age",
"operator": "greater than",
"value": 18
}
],
"compounding": "and",
"orderBy": "age",
"orderType": "desc",
"limit": 10,
"startAfter": 5,
"outputType": "json"
}Response
Output from the Database Collection Fetch Process
Example response
{
"status": "success",
"processing_time": 888,
"processing_id": "4b139bfe-1f71-4345-b539-fa6c1700f166",
"processing_count": 6554,
"data": {
"databaseId": "1234567890",
"collection": "Users",
"elapsed_time": 800,
"data": [
{
"sampleDbContent": "This is a sample content",
"sampleDbContent2": "This is a sample content 2"
},
{
"sampleDbContent": "This is a sample content",
"sampleDbContent2": "This is a sample content 2"
}
]
}
}