Not long ago we added the option to do Eval Patching in RavenDB (see: http://ayende.com/blog/157185/awesome-ravendb-feature-of-the-day-evil-patching)
Recently we added this option to the studio.
Now when you open the studio you will see a new tab in the options for “Patch”
Once there you will see the next screen:
As you can see this page has many options so lets look at them separately
At the top left you have this toolbar with several options, the first one is a combo-box where you can choose what you want to patch (“Document”, “Collection” or “Index”).
Next to it you have the “Test” Option, with this option (which will only be available after selecting a document to check the patch on) when we click on this button the fields on the bottom of the screen (titled “Before Patch” and “After Patch”) will be populated with the selected document and how will it be after we patch.
Next we have the “Save” and “Load” options. With those you can save this page setting and load them again for later use.
Next we have the Patch option that executes the Patch command (this will save the changes to the database)
Let’s look at a small example of patching:
In this case I want to change the Genre name from “Rock” to “Rock and Roll”, after I pressed “Test” I got the screen below, as you can see the “Name” is different.
as you can see on the right of the script we have the “Parameters” list, in there I can do this patch in a different way:
Now I as you can see we added another value to the document with the help of parameters.
Now lets go over the changes when using “Collection”
In “Collection” you can see that the “Patch” option changed into 2 options: “Patch Selected” and “Patch All”.
In order to patch only some of the items in the collection you can select then in the “Matching Documents” section that was added to the page.
Another thing we have is the option to select on which collection we want to patch.
And last we have the option to patch by index:
In addition to the changes we had for “Collection” we now have a field “Query” for the index and the patch will apply only to the documents that match this query (and the “Matching Documents” will update accordingly).