Skip to main content
Version: 1.0 RC1 (Latest)

Query the database

The DefraDB Query Language (DQL) is a GraphQL-based language for storing and querying data in a DefraDB node.

Query Block

Query blocks are read-only GraphQL operations designed only to request information from the database, without the ability to mutate the database state. They contain multiple subqueries which are executed concurrently, unless there is some variable dependency between them.

Queries support database query operations such as filtering, sorting, grouping, skipping/limiting, aggregation, etc. These query operations can be used on different GraphQL object levels, mostly on fields that have some relation or embedding to other objects.

Retrieve all documents of type Book
defradb client query '
{
Book {
_docID
title
plot
}
}
'
Output
{
"data": {
"Book": [
{
"_docID": "bae-546ae840-77c7-51a5-ab0a-b5a893bfa546",
"plot": "A masterpiece of rebellion and imprisonment where war is peace, freedom is slavery, and Big Brother is watching.",
"title": "1984"
},
{
"_docID": "bae-6c91c35c-e548-58f8-86a6-d60ab5174072",
"plot": "At the dawn of the next world war, a plane crashes on an uncharted island, stranding a group of schoolboys.",
"title": "Lord of the Flies"
}
]
}
}