-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1942 from Danielle9897/RDoc-3103-nodejs-revisions…
…Overview RDoc-3103 [Node.js] Document extensions > Revisions > Overview
- Loading branch information
Showing
34 changed files
with
993 additions
and
1,162 deletions.
There are no files selected for viewing
418 changes: 185 additions & 233 deletions
418
...aven.Documentation.Pages/document-extensions/revisions/overview.dotnet.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
307 changes: 307 additions & 0 deletions
307
....4/Raven.Documentation.Pages/document-extensions/revisions/overview.js.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
397 changes: 203 additions & 194 deletions
397
...aven.Documentation.Pages/document-extensions/revisions/overview.python.markdown
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file added
BIN
+17.2 KB
...n.Pages/studio/database/document-extensions/images/revisions/click-revision.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+20.2 KB
...Pages/studio/database/document-extensions/images/revisions/click-to-compare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.6 KB
...studio/database/document-extensions/images/revisions/compare-with-drop-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+142 KB
...ges/studio/database/document-extensions/images/revisions/document-revisions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+28.8 KB
...ges/studio/database/document-extensions/images/revisions/orphaned-revisions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+96 KB
...ges/studio/database/document-extensions/images/revisions/restored-revisions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+130 KB
...es/studio/database/document-extensions/images/revisions/revision-comparison.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+88.4 KB
...es/studio/database/document-extensions/images/revisions/revision-inspection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+75.9 KB
...on.Pages/studio/database/document-extensions/images/revisions/revisions-bin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
174 changes: 174 additions & 0 deletions
174
...aven.Documentation.Pages/studio/database/document-extensions/revisions.markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
# Document Extensions: Revisions | ||
--- | ||
|
||
{NOTE: } | ||
|
||
* **Document Revisions** are snapshots of documents that can be created manually or automatically when a document is created, modified, or deleted. | ||
Revisions can be used for data auditing, instant restoration after document corruption, and other purposes. | ||
|
||
* Learn more about document revisions in this [document revisions overview](../../../document-extensions/revisions/overview): | ||
* To define and enable revisions creation, see [revisions configuration](../../../document-extensions/revisions/overview#revisions-configuration). | ||
* A dynamic walkthrough demonstrating revisions management is available [here](../../../document-extensions/revisions/overview#how-it-works). | ||
|
||
* This article provides an overview of the Studio views related to working with revisions, including: | ||
* Viewing revisions | ||
* Comparing revisions | ||
* Viewing revisions for deleted documents (Revisions Bin) | ||
|
||
--- | ||
|
||
* In this page: | ||
* [Revisions Tab](../../../studio/database/document-extensions/revisions#revisions-tab) | ||
* [Revision inspection](../../../studio/database/document-extensions/revisions#revision-inspection) | ||
* [Revisions comparison](../../../studio/database/document-extensions/revisions#revisions-comparison) | ||
* [Revisions Bin](../../../studio/database/document-extensions/revisions#revisions-bin) | ||
* [Restoring revisions](../../../studio/database/document-extensions/revisions#restoring-revisions) | ||
|
||
{NOTE/} | ||
|
||
--- | ||
|
||
{PANEL: Revisions Tab} | ||
|
||
* Located within the Document View, | ||
the Revisions Tab displays the full trail of all revisions created for the document. | ||
* From this tab, you can inspect each revision, manually force the creation of a new revision, | ||
and compare revisions to the live document version and to other revisions. | ||
|
||
![Revisions Tab](images/revisions/document-revisions.png "Revisions Tab") | ||
|
||
1. [Document View](../../../studio/database/documents/document-view) > **Revisions tab** | ||
Click to display the document's revisions tab. | ||
Revisions are listed in the revisions tab by their creation time signatures. | ||
The current number of revisions is displayed in the tab header. | ||
2. **Create revision** | ||
Click to manually create a new revision for this document from the Studio. | ||
A new revision will be created if the document doesn't already have a revision for the latest content. | ||
[Learn here](../../../document-extensions/revisions/overview#force-revision-creation-via-the-client-api) about forcing the creation of a new revision via the Client API. | ||
3. **Revision timestamp** | ||
Click to inspect this revision. | ||
4. **Compare revision** | ||
Click to compare this revision with the current live version of the document and with other revisions. | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Revision inspection} | ||
|
||
Click the revision timestamp to inspect the revision's contents: | ||
|
||
![Click to Inspect](images/revisions/click-revision.png "Click to Inspect") | ||
|
||
--- | ||
|
||
The revision will be visible in the Document View, | ||
but file editing will Not be available since revisions cannot be modified. | ||
|
||
![Revision Inspection](images/revisions/revision-inspection.png "Revision Inspection") | ||
|
||
1. **Revision** | ||
The REVISION label indicates that you are viewing a revision and not | ||
the parent document. | ||
2. **Clone** | ||
Click to create a document that copies the revision's contents. | ||
{INFO: } | ||
* Cloning the revision will open the 'new document view' with this revision's contents. | ||
* You can then save the clone under a new name to create a new document. | ||
* Saving the clone with the exact same ID as the revision's parent document will revert the document to this revision. | ||
{INFO/} | ||
3. **See the current document** | ||
Click to return to the revision's parent document view. | ||
4. **Revision contents** | ||
The content of the revision is displayed in read-only mode. | ||
|
||
{PANEL/} | ||
|
||
|
||
{PANEL: Revisions comparison} | ||
|
||
Click the revision's comparison button to compare it with other revisions: | ||
|
||
![Click to Compare](images/revisions/click-to-compare.png "Click to Compare") | ||
|
||
--- | ||
|
||
![Revision Comparison](images/revisions/revision-comparison.png "Revision Comparison") | ||
|
||
1. **Exit revisions compare mode** | ||
Click to exit the comparison window and return to the revisions tTab in the Document View. | ||
2. **Compare with** | ||
Click to select a revision to compare with. | ||
![Compare-with Drop List](images/revisions/compare-with-drop-list.png "Compare-with Drop List") | ||
3. **Left-hand revision** | ||
The left-hand view displays the revision selected in the revisions tab. | ||
4. **Right-hand revision** | ||
The right-hand view displays the revision selected using the "Compare with" drop-down list. | ||
5. **Summary line** | ||
This line summarizes the differences found between the two revisions. | ||
|
||
{PANEL/} | ||
|
||
{PANEL: Revisions Bin} | ||
|
||
* This view displays the revisions of deleted documents. | ||
|
||
* When a document is deleted: | ||
* A "delete-revision" is created for the document, marking its deletion. | ||
* The "delete-revision" and all the document's revisions - whether automatically created due to the defined revisions configuration or manually created - are moved to the Revisions Bin. | ||
* This applies regardless of whether a [revisions configuration](../../../document-extensions/revisions/overview#revisions-configuration) is enabled or disabled. | ||
|
||
![Revisions Bin](images/revisions/revisions-bin.png "Revisions Bin") | ||
|
||
1. **Revisions Bin** | ||
Click to open the Revisions Bin view. | ||
Each item listed in the Revisions Bin view references all the revisions created for a deleted document. | ||
2. **Selection boxes** | ||
Check to select items. | ||
3. **Delete** | ||
Click to remove selected items. | ||
Deleting revisions from the Revisions Bin will permanently dispose of these revisions, | ||
making them irrecoverable. | ||
4. **Deleted document ID** | ||
This is the ID of the document that was deleted. | ||
Click it to inspect the revisions created for this document, | ||
known as "orphaned revisions" since their parent document has been deleted. | ||
![Orphaned Revisions](images/revisions/orphaned-revisions.png "Orphaned Revisions") | ||
* Revisions stored in the revisions bin can be [inspected](../../../studio/database/document-extensions/revisions#revision-inspection) | ||
and cloned just like the revisions of a live document. | ||
5. **Change vector** | ||
The change vector of the revision that was created for the document when it was deleted. | ||
6. **Deletion date** | ||
The date/time when the document was deleted. | ||
|
||
--- | ||
|
||
### Restoring revisions | ||
|
||
Giving a **new document** the ID of a deleted document whose revisions are kept in the Revisions Bin, | ||
will restore the revisions from the bin and add them to the new document. | ||
|
||
Opening the document's revisions tab will display the whole audit trail, | ||
including the delete-revision created when the old document was deleted and the revision created when the new document was created. | ||
|
||
![Restored Revisions](images/revisions/restored-revisions.png "Restored Revisions") | ||
|
||
{PANEL/} | ||
|
||
## Related Articles | ||
|
||
### Document Extensions | ||
|
||
* [Document Revisions Overview](../../../document-extensions/revisions/overview) | ||
* [Revert Revisions](../../../document-extensions/revisions/revert-revisions) | ||
* [Revisions and Other Features](../../../document-extensions/revisions/revisions-and-other-features) | ||
|
||
### Client API | ||
|
||
* [Revisions: API Overview](../../../document-extensions/revisions/client-api/overview) | ||
* [Operations: Configuring Revisions](../../../document-extensions/revisions/client-api/operations/configure-revisions) | ||
* [Session: Loading Revisions](../../../document-extensions/revisions/client-api/session/loading) | ||
* [Session: Including Revisions](../../../document-extensions/revisions/client-api/session/including) | ||
* [Session: Counting Revisions](../../../document-extensions/revisions/client-api/session/counting) | ||
|
||
### Studio | ||
|
||
* [Settings: Document Revisions](../../../studio/database/settings/document-revisions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
Documentation/5.4/Samples/nodejs/documentExtensions/revisions/forceRevisionCreation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { DocumentStore } from "ravendb"; | ||
|
||
const documentStore = new DocumentStore(); | ||
|
||
async function forceRevisionCreation() { | ||
{ | ||
//region force_revision_creation_by_entity | ||
// Force revision creation by entity | ||
// ================================= | ||
|
||
const company = new Company(); | ||
company.name = "CompanyName"; | ||
|
||
const session = documentStore.openSession(); | ||
await session.store(company); | ||
await session.saveChanges(); | ||
|
||
// Forcing the creation of a revision by entity can be performed | ||
// only when the entity is tracked, after the document is stored. | ||
await session.advanced.revisions.forceRevisionCreationFor(company); | ||
|
||
// Must call 'saveChanges' for the revision to be created | ||
await session.saveChanges(); | ||
|
||
// Get existing revisions: | ||
const revisions = await session.advanced.revisions.getFor(company.id); | ||
const revisionsCount = revisions.length; | ||
|
||
assert.equal(revisionsCount, 1); | ||
//endregion | ||
} | ||
{ | ||
//region force_revision_creation_by_id | ||
const company = new Company(); | ||
company.name = "CompanyName"; | ||
|
||
const session = documentStore.openSession(); | ||
await session.store(company); | ||
await session.saveChanges(); | ||
|
||
// Force revision creation by ID | ||
const companyId = company.id; | ||
await session.advanced.revisions.forceRevisionCreationFor(companyId); | ||
await session.saveChanges(); | ||
|
||
const revisions = await session.advanced.revisions.getFor(company.id); | ||
const revisionsCount = revisions.length; | ||
|
||
assert.equal(revisionsCount, 1); | ||
//endregion | ||
} | ||
} | ||
|
||
//region syntax_1 | ||
// Available overloads: | ||
// ==================== | ||
forceRevisionCreationFor(entity); | ||
forceRevisionCreationFor(entity, strategy); | ||
forceRevisionCreationFor(id); | ||
forceRevisionCreationFor(id, strategy); | ||
//endregion |
33 changes: 15 additions & 18 deletions
33
Documentation/5.4/Samples/python/DocumentExtensions/Revisions/Revisions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,23 @@ | ||
from examples_base import ExampleBase, Company | ||
from ravendb.primitives import constants | ||
|
||
from examples_base import ExampleBase | ||
|
||
class Force(ExampleBase): | ||
def setUp(self): | ||
super().setUp() | ||
|
||
def test_force_revision_creation_for(self): | ||
with self.embedded_server.get_document_store("ForceRevision") as store: | ||
with store.open_session() as session: | ||
self.add_companies(session) | ||
company_id = "companies/1" | ||
# region force_revision_creation_for | ||
with store.open_session() as session: | ||
company = session.load(company_id, Company) | ||
company.name = "HR V2" | ||
# region force_revision_creation_for | ||
with self.store.open_session() as session: | ||
company = session.load(company_id, Company) | ||
company.name = "HR V2" | ||
|
||
session.advanced.revisions.force_revision_creation_for(company) | ||
session.save_changes() | ||
session.advanced.revisions.force_revision_creation_for(company) | ||
session.save_changes() | ||
|
||
revisions = session.advanced.revisions.get_for(company.Id, Company) | ||
revisions_count = len(revisions) | ||
revisions = session.advanced.revisions.get_for(company.Id, Company) | ||
revisions_count = len(revisions) | ||
|
||
self.assertEqual(1, revisions_count) | ||
# Assert revision contains the value 'Before' the changes... | ||
self.assertEqual("HR V2", revisions[1].name) | ||
# endregion | ||
self.assertEqual(1, revisions_count) | ||
# Assert revision contains the value 'Before' the changes... | ||
self.assertEqual("HR", revisions[0].name) | ||
# endregion |
Binary file removed
BIN
-46.2 KB
...tation.Pages/document-extensions/revisions/images/revisions_create-document.png
Binary file not shown.
Binary file removed
BIN
-72 KB
...n.Documentation.Pages/document-extensions/revisions/images/revisions_create-document.snag
Binary file not shown.
Binary file removed
BIN
-84.3 KB
...ges/document-extensions/revisions/images/revisions_create-revision-manually.png
Binary file not shown.
Binary file removed
BIN
-132 KB
...tation.Pages/document-extensions/revisions/images/revisions_create-revision-manually.snag
Binary file not shown.
Binary file removed
BIN
-68.1 KB
...ation.Pages/document-extensions/revisions/images/revisions_document-created.png
Binary file not shown.
Binary file removed
BIN
-96 KB
....Documentation.Pages/document-extensions/revisions/images/revisions_document-created.snag
Binary file not shown.
Binary file removed
BIN
-73.6 KB
...ation.Pages/document-extensions/revisions/images/revisions_enable-revisions.png
Binary file not shown.
Binary file removed
BIN
-100 KB
....Documentation.Pages/document-extensions/revisions/images/revisions_enable-revisions.snag
Binary file not shown.
Binary file removed
BIN
-73.7 KB
...tation.Pages/document-extensions/revisions/images/revisions_modify-document.png
Binary file not shown.
Binary file removed
BIN
-96 KB
...n.Documentation.Pages/document-extensions/revisions/images/revisions_modify-document.snag
Binary file not shown.
Binary file removed
BIN
-80 KB
...Documentation.Pages/document-extensions/revisions/images/revisions_restored.png
Binary file not shown.
Binary file removed
BIN
-124 KB
....0/Raven.Documentation.Pages/document-extensions/revisions/images/revisions_restored.snag
Binary file not shown.
Binary file removed
BIN
-30.5 KB
...entation.Pages/document-extensions/revisions/images/revisions_revisions-bin.png
Binary file not shown.
Binary file removed
BIN
-52 KB
...ven.Documentation.Pages/document-extensions/revisions/images/revisions_revisions-bin.snag
Binary file not shown.
Oops, something went wrong.