Tina Docs
Introduction
Core Concepts
Querying Content
Editing
Customizing Tina
Going To Production
Drafts
Guides
Further Reference

Updating a document with update<collection>

Our collections for the above schema are named "post" and "author", so we can apply an update to each collection type using the updatePost & updateAuthor.

mutation {
updateAuthor(relativePath: "napolean.json", params: {name: "Napolean", avatar: "https://path.to/my-avatar.jpg"}) {
name
avatar
}
}
{
"data": {
"updateAuthor": {
"name": "Napolean",
"avatar": "https://path.to/my-avatar.jpg"
}
}
}
mutation {
updatePost(relativePath: "voteForPedro.json", params: {title: "Vote For Napolean Instead", category: "politics", author: "content/authors/napolean.json"}) {
title
category
author {
... on Author {
id
}
}
}
}
{
"data": {
"updatePost": {
"title": "Vote For Napolean Instead",
"category": "politics",
"author": {
"id": "content/authors/napolean.json"
}
}
}
}

Last Edited: August 15, 2024