DQL Query Language overview
The DefraDB Query Language (DQL) allows you to store and query data in a DefraDB node. Based on GraphQL, at a high level it has two type of operations: query and mutation blocks.
- Query blocks – The read side of DQL. Retrieve data without the ability to alter it.
- Mutation blocks – The write side of DQL. Mutations rely on the query system to pinpoint the data to update or delete.
As GraphQL queries and mutations must always return some fields, all blocks return a JSON object:
Return object structure
{
"data": {
"<type>": [
<documentObject>
]
}
}
<type>– Object type, such as a collection name.<documentObject>– Return object for each selected document.
In case of error, the data object is null and the error object contains a list of error objects:
Error object structure
{
"errors": [
{
"message": "Field \"Book\" of type \"[Book]\" must have a sub selection."
}
],
"data": null
}