From ae007d3dab777a4ec2132beb529510ad74ee92f6 Mon Sep 17 00:00:00 2001 From: Dominique Plante Date: Thu, 2 May 2013 20:47:13 -0700 Subject: [PATCH 1/2] adjust heading depth so that heading is included in appropriate section in PDF --- .../client-api/querying/results-transformation/index.markdown | 2 +- .../querying/results-transformation/of-type.markdown | 2 +- .../project-from-index-fields-into.markdown | 2 +- .../results-transformation/transform-results.markdown | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/version_2_5/docs/client-api/querying/results-transformation/index.markdown b/version_2_5/docs/client-api/querying/results-transformation/index.markdown index 3fabd8ed42..42a17df79b 100644 --- a/version_2_5/docs/client-api/querying/results-transformation/index.markdown +++ b/version_2_5/docs/client-api/querying/results-transformation/index.markdown @@ -1,4 +1,4 @@ -#Results transformation +### Results transformation Many times index results might be different than objects that you are interested in to work with. RavenDB supports a few mechanism of performing transformations on the query results. To achieve it you are able to use the following methods: diff --git a/version_2_5/docs/client-api/querying/results-transformation/of-type.markdown b/version_2_5/docs/client-api/querying/results-transformation/of-type.markdown index 537edd9869..6379b8afb0 100644 --- a/version_2_5/docs/client-api/querying/results-transformation/of-type.markdown +++ b/version_2_5/docs/client-api/querying/results-transformation/of-type.markdown @@ -1,4 +1,4 @@ -#OfType (As) +##### OfType (As) RavenDB provides a feature called [Live Projections](../static-indexes/live-projections) that offers the ability to transform results of a query on a server side. In order to use it in the Client API you have to use `OfType` (`As`) extension method accessible from `Raven.Client` namespace. diff --git a/version_2_5/docs/client-api/querying/results-transformation/project-from-index-fields-into.markdown b/version_2_5/docs/client-api/querying/results-transformation/project-from-index-fields-into.markdown index 0a37a2cf9a..19f6344ba6 100644 --- a/version_2_5/docs/client-api/querying/results-transformation/project-from-index-fields-into.markdown +++ b/version_2_5/docs/client-api/querying/results-transformation/project-from-index-fields-into.markdown @@ -1,4 +1,4 @@ -##ProjectFromIndexFieldsInto (AsProjection) +#### ProjectFromIndexFieldsInto (AsProjection) The `ProjectFromIndexFieldsInto` (`AsProjection`) method (extension accessible from `Raven.Client` namespace) provides the way to change the type of a query result according to *stored fields in an index*. diff --git a/version_2_5/docs/client-api/querying/results-transformation/transform-results.markdown b/version_2_5/docs/client-api/querying/results-transformation/transform-results.markdown index 4dea13bb8b..d17a99bc13 100644 --- a/version_2_5/docs/client-api/querying/results-transformation/transform-results.markdown +++ b/version_2_5/docs/client-api/querying/results-transformation/transform-results.markdown @@ -1,4 +1,4 @@ -#TransformResults +##### TransformResults If you want to do a client side results transformation in most cases it will be enough to you use standard Linq `Select` method. However if your intention is to create a bit more complex projection then `TransformResults` customization method might be useful. @@ -6,7 +6,7 @@ An advantage of this approach is that you have an access to the executed index q In order to use this method you have to `Customize` your query as is in the example presented below. -##Example +###### Example Let's assume that we have the following classes: From 3157a4246832a50526c19e0976d63bd45e1fe54b Mon Sep 17 00:00:00 2001 From: Dominique Plante Date: Fri, 3 May 2013 21:24:06 -0700 Subject: [PATCH 2/2] adjust heading depth REST API) --- .../http-api/http-api-attachments.markdown | 13 ++++++----- .../docs/http-api/http-api-multi.markdown | 22 +++++++++++-------- .../docs/http-api/http-api-single.markdown | 18 +++++++++------ 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/version_2_5/docs/http-api/http-api-attachments.markdown b/version_2_5/docs/http-api/http-api-attachments.markdown index 3f3f26349e..ec4fc30908 100644 --- a/version_2_5/docs/http-api/http-api-attachments.markdown +++ b/version_2_5/docs/http-api/http-api-attachments.markdown @@ -1,8 +1,9 @@ -#HTTP API - Attachment Operations + +##HTTP API - Attachment Operations Raven supports the concept of attachments. The attachments are binary data that are stored in the database and can be retrieved by a key. -## PUT +#### PUT Perform a PUT request to /static/{attachment key} to create the specified attachment at the given URL: @@ -22,7 +23,7 @@ It is important to note that a PUT in RavenDB will always create the specified a While putting an attachment, it is possible to store metadata about it using HTTP Headers. By default a standard `Content-Type` HTTP header is always stored, however any custom header that you defined will be saved as well. When the attachment is next retrieved by GET request, its metadata are sent back to the client. -## GET +#### GET Retrieving an attachment is done by performing an HTTP GET on the following URL: {CODE-START:plain /} @@ -37,7 +38,7 @@ For example, the following request: Will retrieve an attachment whose key is "users/ayende.jpg", the response to the request is the exact byte stream that was stored in a previous [PUT](http://ravendb.net/docs/http-api/attachments/http-api-put-attachments?version=2.0) request. -## DELETE +#### DELETE Perform a DELETE request to delete the attachment specified by the URL: @@ -53,7 +54,7 @@ For a successful delete, RavenDB will respond with an HTTP response code 204 No The only way a delete can fail is if [the etag doesn't match](http://ravendb.net/docs/http-api/http-api-concurrency?version=2.0), even if the attachment doesn't exist, a delete will still respond with a successful status code. -##HEAD +####HEAD To retrieve only metadata of an attachment execute a HEAD request: @@ -63,7 +64,7 @@ To retrieve only metadata of an attachment execute a HEAD request: For a successful delete, RavenDB will respond with an HTTP response code 200 OK. Metadata will be contained in response headers. -##POST +####POST Perform a POST request to update attachment metadata: diff --git a/version_2_5/docs/http-api/http-api-multi.markdown b/version_2_5/docs/http-api/http-api-multi.markdown index ee22948459..9f0e434234 100644 --- a/version_2_5/docs/http-api/http-api-multi.markdown +++ b/version_2_5/docs/http-api/http-api-multi.markdown @@ -1,6 +1,7 @@ -# Commands on multiple documents -## GET +## Commands on multiple documents + +### GET We can address documents directly by using their key (in the following example, the key is 'users/ayende'): @@ -161,7 +162,7 @@ Besides requesting by using POST to get multiple documents you can also use HTTP > curl -X GET http://localhost:8080/queries?id=users/ayende"&"id=users/oren {CODE-END /} -## Set based operations +### Set based operations Typically, document databases don't support set based operations. Raven does it for deletes and updates. For inserts, you can POST to the [bulk_docs](http-api-multi#batching-requests) endpoint (this is how the Client API behaves). @@ -174,7 +175,7 @@ Note that Raven indexes are allowed to be stale. If the index for the set based The analogous Client API reference section you will find [here](../client-api/set-based-operations). -### Set based deletes +#### Set based deletes For example, let us say that we wanted to delete all the inactive users, we can define an index for the user activity status: @@ -198,7 +199,7 @@ This is the equivalent for: WHERE IsActive = 0 {CODE-END /} -###Set based updates +####Set based updates Set based updates work very similarly to set based deletes. They require an index to operate on an a query for this index. But they use the [PATCH format](../http-api/http-api-single#patch) as their payload. For example, if we wanted to mark all the users who haven't logged on recently as inactive, we could define the following index: @@ -225,7 +226,8 @@ This is the equivalent for: WHERE LastLoginDate < '2010-05-27' {CODE-END /} -##Batching requests +###Batching requests + RavenDB supports batching multiple operations into a single request, reducing the number of remote calls and allowing several operations to share the same transactions. Request batching in RavenDB is handled using the '/bulk_docs' endpoint, which accepts an array of operations to execute. The format for the operations is: @@ -293,8 +295,10 @@ This can be executed using curl with the following syntax: ] {CODE-END /} -###Concurrency +####Concurrency + If an etag is specified in the command, that etag is compared to the current etag on the document on the server. If the etags do no match, a 409 Conflict status code is returned. In such a case, the entire operation fails and non of the updates that were tried will succeed. -###Transactions -All the operations in the batch will succeed or fail as a transaction. Other users will not be able to see any of the changes until the entire batch completes. \ No newline at end of file +####Transactions + +All the operations in the batch will succeed or fail as a transaction. Other users will not be able to see any of the changes until the entire batch completes. diff --git a/version_2_5/docs/http-api/http-api-single.markdown b/version_2_5/docs/http-api/http-api-single.markdown index c55615233f..6d2b0b9367 100644 --- a/version_2_5/docs/http-api/http-api-single.markdown +++ b/version_2_5/docs/http-api/http-api-single.markdown @@ -1,6 +1,6 @@ -#HTTP API - Single Document Operations +##HTTP API - Single Document Operations -##GET +###GET Perform a GET request to read a JSON document from its URL: @@ -24,7 +24,8 @@ If the URL specified does not point to a valid document, RavenDB follows HTTP co HTTP/1.1 404 Not Found -##PUT +###PUT + Perform a PUT request to /docs/{document_id} to create the specified document with the given document id: {CODE-START:json /} @@ -43,7 +44,8 @@ It is important to note that a PUT in RavenDB will always create the specified d A PUT request to /docs without specifying the document id in the URL is an invalid request and RavenDB will return a HTTP 400 Bad Request response code. -##POST +###POST + Perform a POST request to the /docs area to create the specified document and allow RavenDB to assign a unique id to it: {CODE-START:json /} @@ -62,7 +64,7 @@ It is important to note that a repeated POST request for the same document will A POST to a document URL is an invalid request and RavenDB will return a HTTP 400 Bad Request response code. -##PATCH +###PATCH Any single document within RavenDB can be updated without replacing the entire document with a PUT. You can do it either by using [Client API](../client-api/partial-document-updates) or by creating a PATCH request. The PATCH command allows Raven to implement field level concurrency. @@ -91,7 +93,8 @@ For the purposes of these examples, suppose we start with this document: comments: [ {author: 'ayende', text: 'good post'} ] }" {CODE-END /} -###Patch Operations +####Patch Operations + Raven supports the following patch operations: * Set - Set a property to a new value (optionally creating the property). @@ -497,7 +500,8 @@ A subsequent GET of this document would show that the first operation worked, bu Using this approach, you can make an atomic change to the a particular part of a document safely. -## DELETE +### DELETE + Perform a DELETE request to delete the JSON document specified by the URL: {CODE-START:plain /}