The PUT
verb is an HTTP method that can be used to create a resource, with the information in the request, for the URL specified by the client. It is important to note that a PUT
verb in RavenDB will always create the specified document at the requested URL. If the resource already exists, PUT
simply replaces what existed with the new information.
In order to put any document into RavenDB, we will create a PUT
request and use the docs
structure. We have to specify the document ID and the document data in JSON format. Also, we need to specify the name of the collection to which the document will belong. The PUT
request URL is similar to the GET
request URL we created in the previous section.
In case that a PUT
request is sent to the RavenDB's docs
structure without specifying the document ID in the request URL, this request is considered as invalid and RavenDB will return an HTTP error response code.
Once the request is sent to RavenDB, it will respond with the ID of the document...