Skip to main content
FrogBot’s powerful Versions functionality allows you to keep a running history of changes over time and extensible to fit any content publishing workflow.
When enabled, FrogBot will automatically scaffold a new Collection in your database to store versions of your document(s) over time, and the Admin UI will be extended with additional views that allow you to browse document versions, view diffs in order to see exactly what has changed in your documents (and when they changed), and restore documents back to prior versions easily. With Versions, you can:
  • Maintain an audit log / history of every change ever made to a document, including monitoring for what user made which change
  • Restore documents to prior states in case you need to roll back changes
  • Build a true Draft Preview mode for your data
  • Manage who can see Drafts, and who can only see Published documents via Access Control
  • Enable Autosave on collections to never lose your work again
  • Build a powerful publishing schedule mechanism to create documents and have them become publicly readable automatically at a future date
Versions are extremely performant. They don’t change the shape of your data at all. All versions are stored in a separate collection. Versions are enabled by default for every collection — set versions: false to opt out.

Options

Versions support a few different levels of functionality that each come with their own impacts to document workflow.

Versions enabled, drafts disabled

If you enable versions but keep draft mode disabled, FrogBot will simply create a new version of a document each time you update a document. This is great for use cases where you need to retain a history of all document updates over time, but always want to treat the newest document version as the version that is “published”. For example, a use case for “versions enabled, drafts disabled” could be on a collection of users, where you might want to keep a version history (or audit log) of all changes ever made to users - but any changes to users should always be treated as “published” and you have no need to maintain a “draft” version of a user.

Versions and drafts enabled

If you have versions and drafts enabled, you are able to control which documents are published, and which are considered draft. That lets you write Access Control to control who can see published documents, and who can see draft documents. It also lets you save versions (drafts) that are newer than your most recently published document, which is helpful if you want to draft changes and maybe even preview them before you publish the changes. Read more about Drafts here.

Versions, drafts, and autosave enabled

When you have versions, drafts, and autosave enabled, the Admin UI will automatically save changes that you make to a new draft version as you edit a document, which makes sure that you never lose your changes ever again. Autosave will not affect your published post at all—instead, it’ll just save your changes and let you publish them whenever you or your editors are ready to do so. Read more about Autosave here.

Collection config

Versions are enabled by default for every collection (maxPerDoc: 100, drafts disabled). You only need to set the versions key explicitly when you want to opt out or customise the behaviour:
The available options are:

Database impact

By enabling versions, a new database collection will be made to store versions for your collection. The collection will be named based on the collection’s slug and will follow this pattern:
Each document in this new versions collection will store a set of meta properties about the version as well as a full copy of the document. For example, a version’s data might look like this for a Collection document:

Version operations

Versions expose operations that let you query versions, find a single version by ID, and publish or restore a version by ID. They are used primarily by the admin UI, but are also available to custom logic through REST, GraphQL, and Local APIs. Collection REST endpoints: Collection GraphQL queries: And mutation: Collection Local API methods:

Find

Find by ID

Restore

Access Control

Versions expose an Access Control function on Collections that lets you control who can see document versions. For full details on how to use Access Control with Versions, see the Access Control documentation.