Use Revert Revisions to revert the database to its state at a specified point in time.
Being able to restore the database to a previous state can simplify auditing,
enhance understanding of changes made over time,
and facilitate instant recovery without the need to search and retrieve a stored backup.
You can select whether to revert specific collections or revert all collections.
Revert All collections in the database, or toggle off to select Specific collections to revert.
Point in time
Set point in time
Select or enter the point in time (LOCAL) to revert documents to.
The information text on the right will display the expected behavior in UTC.
When the revert process is executed:
Documents created AFTER the specified Point in Time will be moved to the Revision Bin.
Documents created BEFORE this time and that were modified after this time:
Any of these documents that own revisions will be reverted
to the revision created at the specified Point in Time or to the latest revision preceding this time.
When setting a limit on the number of revisions that are kept (by number or by age)
then only the most recent revisions are kept for the document.
If all of these revisions were created AFTER the Point in Time then the oldest revision will be
the one we revert to, even though that revision is newer than the specified time.
By doing so we make sure that all the documents that existed before the specified Point in Time
still exist after the revert process.
Documents created BEFORE this time that were Not modified after this Time are not reverted.
Revisions are ordered in the revisions storage by their change-vector, and Not by creation time.
When reverting the database (or selected collections) to some previous date,
RavenDB will iterate through the revisions, starting from the most recent revision,
and search for revisions that should be restored.
For each revision found - its matching document will be reverted to that revision.
To avoid conducting unnecessarily long searches or revert to revisions that are too old
RavenDB sets a limit to this search.
The search will stop once we hit a revision that was created prior to: Point in Time - Time Window
The default Time Window value is 96 hours (4 days).
Point in Time to revert to: 15.2.2023 02:00
Documents will be reverted to their latest revision that was created prior to this Point in Time.
Time Window: 4 days
We will stop searching the revisions once we hit a revision with creation time prior to: 11.2.2023 02:00
The list below contains revisions of all documents, it is not just revisions of a single document.
The revisions are Not ordered by creation time, the order is set by their change-vector.
=> Document Users/3 stays with this revision content
=> Document Users/4 will be moved to Revisions Bin
=> Document Users/1 will be reverted to this revision
=> Document Users/5 will be reverted to this revision + STOP the search for more Users/5 revisions
=> Document Users/9 will Not be reverted to this revision + STOP the search in this list
. . .
We iterate on the revisions starting from Users/1 revision created on 20.2.2023 01:00.
We search for a relevant revision for document Users/1 by iterating on all Users/1 revisions.
The revision that will be restored for Users/1 is the one from 13.2.2023 01:00 (line 6)
since it is the latest one prior to 15.2.2023 02:00.
Next, we search for a relevant revision for document Users/5 by iterating on all Users/5 revisions,
and we reach line 7.
Here the search for Users/5 revisions will STOP since this revision was created prior to 11.2.2023 02:00.
We will revert the document to this revision since it is the latest one prior to 15.2.2023 02:00.
The following revision for Users/5 from 11.2.2023 03:00 (line 8) is Not restored.
Next, document Users/3 is Not modified, since it wasn't modified after 15.2.2023 02:00.
Next, Users/4 has NO revisions prior to 15.2.2023 02:00,
which means it was created AFTER this Point in Time,
so this document is moved to the Revisions Bin.
Next, we reach Users/9 revision created on 10.2.2023 01:00, which is PRIOR to 11.2.2023 02:00.
The search on this list will now STOP.
No further revisions will be taken into account, not even Users/6 revision created on 11.2.2023 01:00.
When reverting a document to one of its revisions, RavenDB actually creates a new revision for the document.
The content of this new revision is a copy of the historical revision content, and it becomes the current version of the document.
Database items other than documents, such as ongoing tasks, indexes, and compare-exchange,
are Not reverted by this process.
Time series data is Not reverted. Learn more here.
When a document is reverted to a revision that owns attachments,
the attachments are restored to their state when the revision was created.
When a document is reverted to a revision that owns counters,
the counters are restored to functionality along with their values from that revision.