How to roll back data to a previous version using undo API

In the previous post, we have seen how to assign versions to an object. Let’s check how to roll back data to previous versions.

undo function rolls back data to a previous version or specified version.

Let’s check how to change the version of an object using undo.

mutation {
  undo(type: "Object", id:"01gdnn769ewh4q06f67c7cgqrg")
}
#result
{
  "data": {
    "undo": true
  }
}

Above request rolls back data to previous version.
If you need to roll back to a specific version, just provide version number.

mutation {
  undo(type: "Object", id:"01gdnn769ewh4q06f67c7cgqrg", version: 10)
}

In the next post, we will restore rolled back data.