Document patching is the way to modify a document on the server side without having to load it on the client side and saving it back. This is a great way to improve read and write performance. There are no documents sent to the client and no network bandwidth is used. Basically, a patch is a dedicated command that transforms server-side documents directly in the store.
RavenDB allows you to patch documents on the server side by sending either a JavaScript function to the server, or a command to the server with some instructions about how to modify a document (or a set of documents). This feature can be used to update a single document without the need to load the entire object or replacing its entire content.
You can apply patches on a document for creating, renaming, deleting a property, setting values, and so on.
There are many different types of patches supported by RavenDB. To apply a patch you need to call the Patch()
method on the DatabaseCommands
(on the Store
object...