Documents: Patch View
- Use the Patch View to apply an update on your documents in a single operation.
- A patch includes a query that finds the documents you want to update, and an update operation.
-
Read more about patching here.
-
In this page:
Patch View
Figure 1. Patch View
- Patch View
Click to open the patch view. - Database
Click to select the database you want to patch. - Syntax Samples
Click to display patching syntax samples. - Patch Box
Enter your patch script in the patch box. - Apply Patch
Click to apply the patch to your documents (see Apply Patch below). - Test Patch
Click to test your patch without actually applying it to your documents (see Test Patch below).
Patch Configuration
Figure 2. Patch Configuration
- Save Patch
Click to save the currently displayed patch in the local browser storage.
Enter a name and click the Save button again to save the patch. - Load Patch
Click to load a stored patch.
Recent (unsaved) patches will also be shown/listed here.
Hover over a patch name to display its preview.
Click the patch name or the preview Load button to load the patch. -
Patch Settings
-
a. Patch immediately
When this option is selected, clicking the Apply Patch button applies the patch immediately. -
b. Define timeout to wait for index to become non-stale
When this option is selected, clicking the Apply Patch button applies the patch only after the index used by the patch has become non-stale.
If the index remains stale for the duration of the set timeout, the operation is canceled and an exception is thrown.
-
c. Disable creating new Auto-Indexes
If toggled ON, the patch command will not create an auto-index if there is no existing index that serves the patch.
In that case, an exception will be thrown.- Toggling this ON will not affect Auto-Index creation in future Studio patch requests. To disable all future Auto-Index creation from Studio patches, change the default setting in Studio Configuration
-
d. Limit number of operations
Toggle this option ON to set the max number of patch operations per second.
-
Apply Patch
While the patch is executed, a runtime dialog presents -
- Time Elapsed
Time since the operation began - Index
Either the index that was explicitly used by the patch, or the internal RavenDB index that is used for collection queries. - Processed
Number of documents already processed / Number of documents yet to be processed - Processing Speed
Number of documents processed per sec - Estimated time left
- Query
Patch's query and update operation - Progress Bar
- Close
Click to close this dialog.
The operation will proceed in the background.
The dialog can be re-opened from Studio's Notification Center. - Abort
Click to abort the patch operation.
The operation will be reverted.
Test Patch
Click Test to open the patch test dialog.
- Document
Enter a document ID on which to run the patch in the test mode and click Load Document.
The document preview will show in the 'Before' area on the left side. - Test
Click 'Test' to apply the patch to the selected document.
A copy of the document will be patched, leaving the original document unchanged.
A preview of the document after the patch will show in the 'After' area on the right. - Before
Browse the document before the patch has been applied to it.
Click Shift+F11 to expand or collapse an enlarged view of the document. - After
Browse the document After the patch has been applied to it.
See line 198 in the "After" view depicted above for an example of a text modified by the patch.
Click Shift+F11 to expand or collapse an enlarged view of the document. - Done
Click 'Done' to close the test view and return to the patch view.