Skip to main content
Extending FrogBot’s Draft functionality, you can configure collections to autosave changes as drafts and publish only when you’re ready. The Admin UI automatically saves progress at an interval that you define and stores each autosave as a new Draft version. Publish changes to the live document only when you’re ready.
Autosave relies on Versions and Drafts being enabled in order to function.

Options

Collections support two ways to configure autosave. Set versions.drafts.autosave to true, or pass an object to configure autosave properties. Example config with versions, drafts, and autosave enabled:

Autosave API

When autosave is enabled, all update operations within FrogBot expose a new argument called autosave. When set to true, FrogBot will treat the incoming draft update as an autosave. This is primarily used by the Admin UI, but there may be some cases where you are building an app for your users and wish to implement autosave in your own app. To do so, use the autosave argument in your update operations.

How autosaves are stored

If we created a new version for each autosave, you’d quickly find a ton of autosaves that clutter up your _versions collection within the database. That would be messy quick because autosave is typically set to save a document at ~800ms intervals.
Instead of creating a new version each time a document is autosaved, FrogBot smartly only creates one autosave version, and then updates that specific version with each autosave performed. This makes sure that your versions remain nice and tidy.