Home
Blog
Showcase
Community
Introduction
Overview
Introduction To TinaCMS
Getting Started
Using the Tina Editor
FAQ
Core Concepts
Content Modeling
Data Fetching
Visual Editing
Querying Content
Overview
Writing custom queries
Editing
Overview
Markdown & MDX
Block-based editing
Single Document Collections
Customizing Tina
Overview
Validation
Custom Field Components
Custom List Rendering
Format and Parse Input
Filename Customization
Before Submit function
Going To Production
Overview
Tina Cloud
Self-Hosted
Drafts
Overview
Draft Fields
Editorial Workflow
Guides
Overview
Framework Guides
Separate Content Repo
Querying Tina Content at Runtime
Internationalization
Migrating From Forestry
Reference
Overview
Config
Schema
The "tina" folder
The TinaCMS CLI
Media
Search
Content API
Overview
Running the Local GraphQL API
Querying the API
Overview
Getting a Single Document
Querying a List of Documents
Updating a Document
Adding a Document
Using Curl & Fetch
Data Layer
Tina's edit state
The "tinaField" helper
Self-Hosted Components

Schema-specific queries

When you define a schema, TinaCMS will generate a GraphQL API which treats your local filesystem as a database. You can serve this schema locally via the CLI or you can consume it from Tina Cloud.

The GraphQL API will generate queries which are specific to the schema you define.

Available queries:

  • <collection>
  • <collection>Connection

Available mutations

  • update<collection>
  • addPendingDocument

For a given collection, it's name will be used to generate <collection> and <collection>Connection queries, and the update<collection> mutation.

General queries

As an alternative to the schema-specific queries, the GraphQL API also makes the following general queries available:

  • document
  • collection
  • collections
  • addPendingDocument
  • updateDocument

Example schema

Using the following schema, we'll show you how each of the schema-specific queries/mutations can be used.

import { defineConfig } from 'tinacms'
export default defineConfig({
// ...
schema: {
collections: [
{
label: 'Blog Posts',
name: 'post',
path: 'content/posts',
format: 'json',
fields: [
{
type: 'string',
label: 'Title',
name: 'title',
},
{
type: 'string',
label: 'Category',
name: 'category',
},
{
type: 'datetime',
label: 'Date',
name: 'date',
},
{
type: 'reference',
label: 'Author',
name: 'author',
collections: ['author'],
},
],
indexes: [
{
name: 'category-date',
fields: [{ name: 'category' }, { name: 'date' }],
},
],
},
{
label: 'Authors',
name: 'author',
format: 'json',
path: 'content/authors',
fields: [
{
type: 'string',
label: 'Name',
name: 'name',
},
{
type: 'string',
label: 'Avatar',
name: 'avatar',
},
],
},
],
},
})

Product

Showcase
Tina Cloud
Introduction
How Tina Works
Roadmap

Resources

Blog
Examples
Support
Media

Whats New
TinaCMS
TinaCloud
Use Cases
Agencies
Documentation
Teams
Jamstack CMS
Benefits
MDX
Markdown
Git
Editorial Workflow
Customization
SEO
Comparisons
TinaCMS vs Storyblok
TinaCMS vs Sanity
TinaCMS vs DecapCMS
TinaCMS vs Contentful
TinaCMS vs Builder.io
TinaCMS vs Strapi
Integrations
Astro
Hugo
NextJS
Jekyll