The list of entities can be retrieved from the database by using find query which is defined for every database for each space. For example findBugs, findEmployees.
Use findXXX without arguments to retrieve all records, but note that there is a limit of 100 by default, so use offset and limit to retrieve data page by page if it is required.
{ findFeatures { id name state { name } }}
Use Docs → Query section to explore possible fields selection.Curl:
There is a variety of filtering capabilities for each database including filtering by one-to-one fields or inner lists content. Filters can be applied by providing filtering arguments for find queries.The filter operators available can be discovered through autocomplete while creating a query in GraphiQL.Filtering by native fields
{ findBugs( name: {contains: "disaster"} state: {name: {in: ["Open", "Done"]}} ) { id name state { name } }}
Filtering by one-to-one fieldsFind Open and Done bugs, for example:
{ findBugs( state: {name: {in: ["Open", "Done"]}} ) { id name state { name } }}
The database can be filtered by content of inner list, but it is a bit different from filtering by one-to-one or native fields. For example the query to the left allows to find releases which contains bugs in “Open” state or with effort greater than 0.The following operators can be used for filtering database by inner list:
isEmpty: Booleancontains: [InnerListDbFilter] // AND statementcontainsAny: [InnerListDbFilter] // OR statementnotContains: [InnerListDbFilter] // AND statementnotContainsAny: [InnerListDbFilter] // OR statement
Filtering by inner lists:
{ findReleases( bugs: { containsAny: [ {state: {name: {is: "Open"}}} {effort: {greater: 0}} ] }) { name bugs { name state { name } } }}
The inner list of database can be filtered in the same way the database filtered. For example if you want to show only “To Do” bugs for releases:Sample of filtering inner list
{ findReleases { name bugs(state: {name: {is: "To Do"}}) { name state { name } } }}
The database or content of inner lists of the database can be sorted using orderBy argument which can be applied for native fields or one-to-one properties.
{ findReleases( bugs: {isEmpty: false} orderBy: { releaseDate: DESC } ) { name releaseDate bugs( orderBy: { name: ASC createdBy: {email: ASC} } ) { name state { name } } }}
You can download content of rich text fields or comments in four formats: jsonString, text, md, html.
{ findBugs { name stepsToReproduce { text } comments { md } }}
Output
{ "data": { "findBugs": [ { "name": "🐞 The first ever bug", "stepsToReproduce": { "text": "Open up the Mark II\n\n\nCheck all the relays one-by-one\n\n\nFind a little naughty moth" }, "comments": [ { "md": "Please fix ASAP" } ] } ] }}
By default, find database query returns 100 records. The default can be changed by setting limit argument. Use offset argument to retrieve next page if the current page contains 100 records (or equals to limit value).Retrieve first page (limit is 3)
{ findBugs(limit: 3) { name }}
Retrieve second page (limit: 3, offset: 3). Retrieve only if first page size equals to 3