mirror of https://gitee.com/bigwinds/arangodb
edge handling
This commit is contained in:
parent
096e7bfbf8
commit
577cc50e1f
|
@ -1,27 +1,15 @@
|
|||
!CHAPTER Working with Edges using REST
|
||||
|
||||
This is documentation to ArangoDB's [REST interface for edges](../../Manual/Graphs/Edges/index.html).
|
||||
This is documentation to ArangoDB's
|
||||
[REST interface for edges](../../Manual/Graphs/Edges/index.html).
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_READ
|
||||
Edges are documents with two additional attributes: *_from* and *_to*.
|
||||
These attributes are mandatory and must contain the document-handle
|
||||
of the from and to vertices of an edge.
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_READ_ALL
|
||||
Use the general document
|
||||
[REST api](../Document/WorkingWithDocuments.html)
|
||||
for create/read/update/delete.
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_CREATE
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_UPDATES
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_REPLACE
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_DELETE
|
||||
|
||||
<!-- arangod/RestHandler/RestEdgeHandler.cpp -->
|
||||
@startDocuBlock API_EDGE_READ_HEAD
|
||||
|
||||
<!-- js/actions/api-edges.js -->
|
||||
<!-- Rest/Graph edges -->
|
||||
@startDocuBlock API_EDGE_READINOUTBOUND
|
||||
|
|
|
@ -1,79 +1,3 @@
|
|||
!CHAPTER Administration
|
||||
|
||||
!SECTION Durability Configuration
|
||||
|
||||
!SUBSECTION Global Configuration
|
||||
|
||||
There are global configuration values for durability, which can be adjusted by
|
||||
specifying the following configuration options:
|
||||
|
||||
@startDocuBlock databaseWaitForSync
|
||||
|
||||
|
||||
@startDocuBlock databaseForceSyncProperties
|
||||
|
||||
|
||||
@startDocuBlock WalLogfileSyncInterval
|
||||
|
||||
|
||||
!SUBSECTION Per-collection configuration
|
||||
|
||||
You can also configure the durability behavior on a per-collection basis.
|
||||
Use the ArangoDB shell to change these properties.
|
||||
|
||||
|
||||
@startDocuBlock collectionProperties
|
||||
|
||||
|
||||
!SUBSECTION Per-operation configuration
|
||||
|
||||
Many data-modification operations and also ArangoDB's transactions allow to specify
|
||||
a *waitForSync* attribute, which when set ensures the operation data has been
|
||||
synchronized to disk when the operation returns.
|
||||
|
||||
!SECTION Disk-Usage Configuration
|
||||
|
||||
The amount of disk space used by ArangoDB is determined by a few configuration
|
||||
options.
|
||||
|
||||
!SUBSECTION Global Configuration
|
||||
|
||||
The total amount of disk storage required by ArangoDB is determined by the size of
|
||||
the write-ahead logfiles plus the sizes of the collection journals and datafiles.
|
||||
|
||||
There are the following options for configuring the number and sizes of the write-ahead
|
||||
logfiles:
|
||||
|
||||
<!-- arangod/Wal/LogfileManager.h -->
|
||||
@startDocuBlock WalLogfileReserveLogfiles
|
||||
|
||||
|
||||
<!-- arangod/Wal/LogfileManager.h -->
|
||||
@startDocuBlock WalLogfileHistoricLogfiles
|
||||
|
||||
|
||||
<!-- arangod/Wal/LogfileManager.h -->
|
||||
@startDocuBlock WalLogfileSize
|
||||
|
||||
|
||||
<!-- arangod/Wal/LogfileManager.h -->
|
||||
@startDocuBlock WalLogfileAllowOversizeEntries
|
||||
|
||||
|
||||
<!-- arangod/Wal/LogfileManager.h -->
|
||||
@startDocuBlock WalLogfileSuppressShapeInformation
|
||||
|
||||
|
||||
When data gets copied from the write-ahead logfiles into the journals or datafiles
|
||||
of collections, files will be created on the collection level. How big these files
|
||||
are is determined by the following global configuration value:
|
||||
|
||||
<!-- arangod/RestServer/ArangoServer.h -->
|
||||
@startDocuBlock databaseMaximalJournalSize
|
||||
|
||||
|
||||
!SUBSECTION Per-collection configuration
|
||||
|
||||
The journal size can also be adjusted on a per-collection level using the collection's
|
||||
*properties* method.
|
||||
|
||||
Most administration can be managed using the *arangosh*.
|
|
@ -29,6 +29,21 @@ automatically started.
|
|||
For startup parameters, installation in a cluster and so on, see
|
||||
[Installing](Installing/README.md).
|
||||
|
||||
!SUBSECTION Securing the installation
|
||||
|
||||
The default installation contains one database *_system* and a user
|
||||
named *root*.
|
||||
|
||||
Debian based packages and the Windows installer will ask for a
|
||||
password during the installation process. For all other installation
|
||||
packages you need to execute
|
||||
|
||||
```
|
||||
shell> arango-secure-installation
|
||||
```
|
||||
|
||||
This will asked for a root password and sets this password.
|
||||
|
||||
!SUBSECTION Web interface
|
||||
|
||||
The server itself speaks REST and VelocyStream, but you can use the
|
||||
|
@ -45,7 +60,7 @@ see [Troubleshooting](../Troubleshooting/README.md).
|
|||
By default, authentication is enabled. There default user is
|
||||
`root`. Depending on the installation method used, the installation
|
||||
processed either prompted for the root password or the default root
|
||||
password is empty.
|
||||
password is empty (see [above](#securing_the_installation).
|
||||
|
||||
It should look like this:
|
||||
TODO MISSING
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
* [Windows](GettingStarted/Installing/Windows.md)
|
||||
* [Compiling](GettingStarted/Installing/Compiling.md)
|
||||
* [Cluster setup](GettingStarted/Installing/Cluster.md)
|
||||
* [Authentication](GettingStarted/Authentication.md)
|
||||
* [Using the Web Interface](GettingStarted/WebInterface.md)
|
||||
* [Coming from SQL](GettingStarted/ComingFromSql.md)
|
||||
# * [Coming from MongoDB](GettingStarted/ComingFromMongoDb.md) #TODO
|
||||
|
@ -102,6 +103,8 @@
|
|||
* [Cluster: Local test](Deployment/Local.md)
|
||||
#
|
||||
* [Administration](Administration/README.md)
|
||||
* [Managing Users](Administration/ManagingUsers.md)
|
||||
* [Durability](Administration/Durability.md)
|
||||
* [ArangoDB Shell](Administration/Arangosh/README.md)
|
||||
* [Shell Output](Administration/Arangosh/Output.md)
|
||||
* [Configuration](Administration/Arangosh/Configuration.md)
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_CREATE
|
||||
@brief creates an edge
|
||||
|
||||
@RESTHEADER{POST /_api/document,Create edge}
|
||||
|
||||
@RESTALLBODYPARAM{edge-document,json,required}
|
||||
A JSON representation of the edge document must be passed as the body of
|
||||
the POST request. This JSON object may contain the edge's document key in
|
||||
the *_key* attribute if needed.
|
||||
|
||||
@RESTQUERYPARAMETERS
|
||||
|
||||
@RESTQUERYPARAM{collection,string,required}
|
||||
Creates a new edge in the collection identified by *collection* name.
|
||||
|
||||
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||
Wait until the edge document has been synced to disk.
|
||||
|
||||
@RESTQUERYPARAM{from,string,required}
|
||||
The document handle of the start point must be passed in *from* handle.
|
||||
|
||||
@RESTQUERYPARAM{to,string,required}
|
||||
The document handle of the end point must be passed in *to* handle.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Creates a new edge document in the collection named *collection*. A JSON
|
||||
representation of the document must be passed as the body of the POST
|
||||
request.
|
||||
|
||||
In all other respects the method works like *POST /_api/document* for
|
||||
documents.
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{201}
|
||||
is returned if the edge was created successfully and *waitForSync* was
|
||||
*true*.
|
||||
|
||||
@RESTRETURNCODE{202}
|
||||
is returned if the edge was created successfully and *waitForSync* was
|
||||
*false*.
|
||||
|
||||
@RESTRETURNCODE{400}
|
||||
is returned if the body does not contain a valid JSON representation of an
|
||||
edge, or if the collection specified is not an edge collection.
|
||||
The response body contains an error document in this case.
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the collection specified by *collection* is unknown. The
|
||||
response body contains an error document in this case.
|
||||
|
||||
@EXAMPLES
|
||||
|
||||
Create an edge and read it back:
|
||||
|
||||
@EXAMPLE_ARANGOSH_RUN{RestEdgeCreateEdge}
|
||||
try {
|
||||
db._graphs.remove("graph");
|
||||
db._drop("edges");
|
||||
db._drop("vertices");
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
var Graph = require("@arangodb/general-graph");
|
||||
var g = Graph._create("graph", [Graph._relation("edges", "vertices", "vertices")]);
|
||||
g.vertices.save({_key: "1"});
|
||||
g.vertices.save({_key: "2"});
|
||||
var url = "/_api/document/?collection=edges";
|
||||
|
||||
var response = logCurlRequest("POST", url, { "name": "Emil", _from: "vertices/1", _to: "vertices/2"});
|
||||
|
||||
assert(response.code === 202);
|
||||
|
||||
logJsonResponse(response);
|
||||
var body = response.body.replace(/\\/g, '');
|
||||
var edge_id = JSON.parse(body)._id;
|
||||
var response2 = logCurlRequest("GET", "/_api/document/" + edge_id);
|
||||
|
||||
assert(response2.code === 200);
|
||||
|
||||
logJsonResponse(response2);
|
||||
db._drop("edges");
|
||||
db._drop("vertices");
|
||||
db._graphs.remove("graph");
|
||||
@END_EXAMPLE_ARANGOSH_RUN
|
||||
@endDocuBlock
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_DELETE
|
||||
@brief deletes an edge
|
||||
|
||||
@RESTHEADER{DELETE /_api/document/{document-handle}#deleteEdge, Deletes edge}
|
||||
|
||||
@RESTURLPARAMETERS
|
||||
|
||||
@RESTURLPARAM{document-handle,string,required}
|
||||
Deletes the edge document identified by *document-handle*.
|
||||
|
||||
@RESTQUERYPARAMETERS
|
||||
|
||||
@RESTQUERYPARAM{rev,string,optional}
|
||||
You can conditionally delete an edge document based on a target revision id by
|
||||
using the *rev* query parameter.
|
||||
|
||||
@RESTQUERYPARAM{policy,string,optional}
|
||||
To control the update behavior in case there is a revision mismatch, you
|
||||
can use the *policy* parameter. This is the same as when replacing edge
|
||||
documents (see replacing edge documents for more details).
|
||||
|
||||
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||
Wait until edge document has been synced to disk.
|
||||
|
||||
@RESTHEADERPARAMETERS
|
||||
|
||||
@RESTHEADERPARAM{If-Match,string,optional}
|
||||
You can conditionally delete an edge document based on a target revision id by
|
||||
using the *if-match* HTTP header.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
The body of the response contains a JSON object with the information about
|
||||
the handle and the revision. The attribute *_id* contains the known
|
||||
*document-handle* of the deleted edge document, *_key* contains the key which
|
||||
uniquely identifies a document in a given collection, and the attribute *_rev*
|
||||
contains the new document revision.
|
||||
|
||||
If the *waitForSync* parameter is not specified or set to
|
||||
*false*, then the collection's default *waitForSync* behavior is
|
||||
applied. The *waitForSync* query parameter cannot be used to disable
|
||||
synchronization for collections that have a default *waitForSync* value
|
||||
of *true*.
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{200}
|
||||
is returned if the edge document was deleted successfully and *waitForSync* was
|
||||
*true*.
|
||||
|
||||
@RESTRETURNCODE{202}
|
||||
is returned if the edge document was deleted successfully and *waitForSync* was
|
||||
*false*.
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the collection or the edge document was not found.
|
||||
The response body contains an error document in this case.
|
||||
|
||||
@RESTRETURNCODE{412}
|
||||
is returned if a "If-Match" header or *rev* is given and the found
|
||||
document has a different version. The response will also contain the found
|
||||
document's current revision in the *_rev* attribute. Additionally, the
|
||||
attributes *_id* and *_key* will be returned.
|
||||
@endDocuBlock
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_READ
|
||||
@brief reads a single edge
|
||||
|
||||
@RESTHEADER{GET /_api/document/{document-handle}#readEdge, Read edge}
|
||||
|
||||
@RESTURLPARAMETERS
|
||||
|
||||
@RESTURLPARAM{document-handle,string,required}
|
||||
The handle of the edge document.
|
||||
|
||||
@RESTHEADERPARAMETERS
|
||||
|
||||
@RESTHEADERPARAM{If-None-Match,string,optional}
|
||||
If the "If-None-Match" header is given, then it must contain exactly one
|
||||
etag. The edge is returned if it has a different revision than the
|
||||
given etag. Otherwise an *HTTP 304* is returned.
|
||||
|
||||
@RESTHEADERPARAM{If-Match,string,optional}
|
||||
If the "If-Match" header is given, then it must contain exactly one
|
||||
etag. The edge is returned if it has the same revision ad the
|
||||
given etag. Otherwise a *HTTP 412* is returned. As an alternative
|
||||
you can supply the etag in an attribute *rev* in the URL.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Returns the edge identified by *document-handle*. The returned
|
||||
edge contains a few special attributes:
|
||||
|
||||
- *_id* contains the document handle
|
||||
|
||||
- *_rev* contains the revision
|
||||
|
||||
- *_from* and *to* contain the document handles of the connected
|
||||
vertex documents
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{200}
|
||||
is returned if the edge was found
|
||||
|
||||
@RESTRETURNCODE{304}
|
||||
is returned if the "If-None-Match" header is given and the edge has
|
||||
the same version
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the edge or collection was not found
|
||||
|
||||
@RESTRETURNCODE{412}
|
||||
is returned if a "If-Match" header or *rev* is given and the found
|
||||
document has a different version. The response will also contain the found
|
||||
document's current revision in the *_rev* attribute. Additionally, the
|
||||
attributes *_id* and *_key* will be returned.
|
||||
@endDocuBlock
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_READ_HEAD
|
||||
@brief reads a single edge head
|
||||
|
||||
@RESTHEADER{HEAD /_api/document/{document-handle}readEdgeHead, Read edge header}
|
||||
|
||||
@RESTURLPARAMETERS
|
||||
|
||||
@RESTURLPARAM{document-handle,string,required}
|
||||
The handle of the edge document.
|
||||
|
||||
@RESTQUERYPARAMETERS
|
||||
|
||||
@RESTQUERYPARAM{rev,string,optional}
|
||||
You can conditionally fetch an edge document based on a target revision id by
|
||||
using the *rev* query parameter.
|
||||
|
||||
@RESTHEADERPARAMETERS
|
||||
|
||||
@RESTHEADERPARAM{If-None-Match,string,optional}
|
||||
If the "If-None-Match" header is given, then it must contain exactly one
|
||||
etag. If the current document revision is different to the specified etag,
|
||||
an *HTTP 200* response is returned. If the current document revision is
|
||||
identical to the specified etag, then an *HTTP 304* is returned.
|
||||
|
||||
@RESTHEADERPARAM{If-Match,string,optional}
|
||||
You can conditionally fetch an edge document based on a target revision id by
|
||||
using the *if-match* HTTP header.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Like *GET*, but only returns the header fields and not the body. You
|
||||
can use this call to get the current revision of an edge document or check if
|
||||
it was deleted.
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{200}
|
||||
is returned if the edge document was found
|
||||
|
||||
@RESTRETURNCODE{304}
|
||||
is returned if the "If-None-Match" header is given and the edge document has
|
||||
same version
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the edge document or collection was not found
|
||||
|
||||
@RESTRETURNCODE{412}
|
||||
is returned if a "If-Match" header or *rev* is given and the found
|
||||
document has a different version. The response will also contain the found
|
||||
document's current revision in the *etag* header.
|
||||
@endDocuBlock
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_REPLACE
|
||||
@brief replaces an edge
|
||||
|
||||
@RESTHEADER{PUT /_api/document/{document-handle}#replaceEdge, replaces an edge}
|
||||
|
||||
@RESTALLBODYPARAM{edge,json,required}
|
||||
A JSON representation of the new edge data. Including *_from* and *_to* is mandatory.
|
||||
|
||||
@RESTURLPARAMETERS
|
||||
|
||||
@RESTURLPARAM{document-handle,string,required}
|
||||
The handle of the edge document.
|
||||
|
||||
@RESTQUERYPARAMETERS
|
||||
|
||||
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||
Wait until edge document has been synced to disk.
|
||||
|
||||
@RESTQUERYPARAM{rev,string,optional}
|
||||
You can conditionally replace an edge document based on a target revision id by
|
||||
using the *rev* query parameter.
|
||||
|
||||
@RESTQUERYPARAM{policy,string,optional}
|
||||
To control the update behavior in case there is a revision mismatch, you
|
||||
can use the *policy* parameter (see below).
|
||||
|
||||
@RESTHEADERPARAMETERS
|
||||
|
||||
@RESTHEADERPARAM{If-Match,string,optional}
|
||||
You can conditionally replace an edge document based on a target revision id by
|
||||
using the *if-match* HTTP header.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Completely updates (i.e. replaces) the edge document identified by *document-handle*.
|
||||
If the edge document exists and can be updated, then a *HTTP 201* is returned
|
||||
and the "ETag" header field contains the new revision of the edge document.
|
||||
|
||||
If the new edge document passed in the body of the request contains the
|
||||
*document-handle* in the attribute *_id* and the revision in *_rev*,
|
||||
these attributes will be ignored. Only the URI and the "ETag" header are
|
||||
relevant in order to avoid confusion when using proxies.
|
||||
|
||||
Optionally, the query parameter *waitForSync* can be used to force
|
||||
synchronization of the edge document replacement operation to disk even in case
|
||||
that the *waitForSync* flag had been disabled for the entire collection.
|
||||
Thus, the *waitForSync* query parameter can be used to force synchronization
|
||||
of just specific operations. To use this, set the *waitForSync* parameter
|
||||
to *true*. If the *waitForSync* parameter is not specified or set to
|
||||
*false*, then the collection's default *waitForSync* behavior is
|
||||
applied. The *waitForSync* query parameter cannot be used to disable
|
||||
synchronization for collections that have a default *waitForSync* value
|
||||
of *true*.
|
||||
|
||||
The body of the response contains a JSON object with the information about
|
||||
the handle and the revision. The attribute *_id* contains the known
|
||||
*document-handle* of the updated edge document, *_key* contains the key which
|
||||
uniquely identifies a document in a given collection, and the attribute *_rev*
|
||||
contains the new document revision.
|
||||
|
||||
If the edge document does not exist, then a *HTTP 404* is returned and the
|
||||
body of the response contains an error document.
|
||||
|
||||
There are two ways for specifying the targeted revision id for
|
||||
conditional replacements (i.e. replacements that will only be executed if
|
||||
the revision id found in the database matches the revision id specified
|
||||
in the request):
|
||||
- specifying the target revision in the *rev* URL query parameter
|
||||
- specifying the target revision in the *if-match* HTTP header
|
||||
|
||||
Specifying a target revision is optional, however, if done, only one of the
|
||||
described mechanisms must be used (either the *rev* query parameter or the
|
||||
*if-match* HTTP header).
|
||||
Regardless which mechanism is used, the parameter needs to contain the target
|
||||
revision id as returned in the *_rev* attribute of an edge document or
|
||||
by an HTTP *etag* header.
|
||||
|
||||
For example, to conditionally replace an edge document based on a specific revision
|
||||
id, you can use the following request:
|
||||
|
||||
- PUT /_api/document/*document-handle*?rev=*etag*
|
||||
|
||||
If a target revision id is provided in the request (e.g. via the *etag* value
|
||||
in the *rev* URL query parameter above), ArangoDB will check that
|
||||
the revision id of the edge document found in the database is equal to the target
|
||||
revision id provided in the request. If there is a mismatch between the revision
|
||||
id, then by default a *HTTP 412* conflict is returned and no replacement is
|
||||
performed.
|
||||
|
||||
The conditional update behavior can be overridden with the *policy* URL query parameter:
|
||||
|
||||
- PUT /_api/document/*document-handle*?policy=*policy*
|
||||
|
||||
If *policy* is set to *error*, then the behavior is as before: replacements
|
||||
will fail if the revision id found in the database does not match the target
|
||||
revision id specified in the request.
|
||||
|
||||
If *policy* is set to *last*, then the replacement will succeed, even if the
|
||||
revision id found in the database does not match the target revision id specified
|
||||
in the request. You can use the *last* *policy* to force replacements.
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{201}
|
||||
is returned if the edge document was replaced successfully and *waitForSync* was
|
||||
*true*.
|
||||
|
||||
@RESTRETURNCODE{202}
|
||||
is returned if the edge document was replaced successfully and *waitForSync* was
|
||||
*false*.
|
||||
|
||||
@RESTRETURNCODE{400}
|
||||
is returned if the body does not contain a valid JSON representation of an edge
|
||||
document or if applied to a non-edge collection. The response body contains an
|
||||
error document in this case.
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the collection or the edge document was not found
|
||||
|
||||
@RESTRETURNCODE{412}
|
||||
is returned if a "If-Match" header or *rev* is given and the found
|
||||
document has a different version. The response will also contain the found
|
||||
document's current revision in the *_rev* attribute. Additionally, the
|
||||
attributes *_id* and *_key* will be returned.
|
||||
@endDocuBlock
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
|
||||
@startDocuBlock API_EDGE_UPDATES
|
||||
@brief updates an edge
|
||||
|
||||
@RESTHEADER{PATCH /_api/document/{document-handle}#patchEdge, Patches edge}
|
||||
|
||||
@RESTALLBODYPARAM{document,json,required}
|
||||
A JSON representation of the edge update.
|
||||
|
||||
@RESTURLPARAMETERS
|
||||
|
||||
@RESTURLPARAM{document-handle,string,required}
|
||||
The handle of the edge document.
|
||||
|
||||
@RESTQUERYPARAMETERS
|
||||
|
||||
@RESTQUERYPARAM{keepNull,boolean,optional}
|
||||
If the intention is to delete existing attributes with the patch command,
|
||||
the URL query parameter *keepNull* can be used with a value of *false*.
|
||||
This will modify the behavior of the patch command to remove any attributes
|
||||
from the existing edge document that are contained in the patch document with an
|
||||
attribute value of *null*.
|
||||
|
||||
@RESTQUERYPARAM{mergeObjects,boolean,optional}
|
||||
Controls whether objects (not arrays) will be merged if present in both the
|
||||
existing and the patch edge. If set to *false*, the value in the
|
||||
patch edge will overwrite the existing edge's value. If set to
|
||||
*true*, objects will be merged. The default is *true*.
|
||||
|
||||
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||
Wait until edge document has been synced to disk.
|
||||
|
||||
@RESTQUERYPARAM{rev,string,optional}
|
||||
You can conditionally patch an edge document based on a target revision id by
|
||||
using the *rev* query parameter.
|
||||
|
||||
@RESTQUERYPARAM{policy,string,optional}
|
||||
To control the update behavior in case there is a revision mismatch, you
|
||||
can use the *policy* parameter.
|
||||
|
||||
@RESTHEADERPARAMETERS
|
||||
|
||||
@RESTHEADERPARAM{If-Match,string,optional}
|
||||
You can conditionally patch an edge document based on a target revision id by
|
||||
using the *if-match* HTTP header.
|
||||
|
||||
@RESTDESCRIPTION
|
||||
Partially updates the edge document identified by *document-handle*.
|
||||
The body of the request must contain a JSON document with the attributes
|
||||
to patch (the patch document). All attributes from the patch document will
|
||||
be added to the existing edge document if they do not yet exist, and overwritten
|
||||
in the existing edge document if they do exist there.
|
||||
|
||||
Setting an attribute value to *null* in the patch document will cause a
|
||||
value of *null* be saved for the attribute by default.
|
||||
|
||||
**Note**: Internal attributes such as *_key*, *_from* and *_to* are immutable
|
||||
once set and cannot be updated.
|
||||
|
||||
Optionally, the query parameter *waitForSync* can be used to force
|
||||
synchronization of the edge document update operation to disk even in case
|
||||
that the *waitForSync* flag had been disabled for the entire collection.
|
||||
Thus, the *waitForSync* query parameter can be used to force synchronization
|
||||
of just specific operations. To use this, set the *waitForSync* parameter
|
||||
to *true*. If the *waitForSync* parameter is not specified or set to
|
||||
*false*, then the collection's default *waitForSync* behavior is
|
||||
applied. The *waitForSync* query parameter cannot be used to disable
|
||||
synchronization for collections that have a default *waitForSync* value
|
||||
of *true*.
|
||||
|
||||
The body of the response contains a JSON object with the information about
|
||||
the handle and the revision. The attribute *_id* contains the known
|
||||
*document-handle* of the updated edge document, *_key* contains the key which
|
||||
uniquely identifies a document in a given collection, and the attribute *_rev*
|
||||
contains the new document revision.
|
||||
|
||||
If the edge document does not exist, then a *HTTP 404* is returned and the
|
||||
body of the response contains an error document.
|
||||
|
||||
You can conditionally update an edge document based on a target revision id by
|
||||
using either the *rev* query parameter or the *if-match* HTTP header.
|
||||
To control the update behavior in case there is a revision mismatch, you
|
||||
can use the *policy* parameter. This is the same as when replacing
|
||||
edge documents (see replacing documents for details).
|
||||
|
||||
@RESTRETURNCODES
|
||||
|
||||
@RESTRETURNCODE{201}
|
||||
is returned if the document was patched successfully and *waitForSync* was
|
||||
*true*.
|
||||
|
||||
@RESTRETURNCODE{202}
|
||||
is returned if the document was patched successfully and *waitForSync* was
|
||||
*false*.
|
||||
|
||||
@RESTRETURNCODE{400}
|
||||
is returned if the body does not contain a valid JSON representation or when
|
||||
applied on an non-edge collection. The response body contains an error document
|
||||
in this case.
|
||||
|
||||
@RESTRETURNCODE{404}
|
||||
is returned if the collection or the edge document was not found
|
||||
|
||||
@RESTRETURNCODE{412}
|
||||
is returned if a "If-Match" header or *rev* is given and the found
|
||||
document has a different version. The response will also contain the found
|
||||
document's current revision in the *_rev* attribute. Additionally, the
|
||||
attributes *_id* and *_key* will be returned.
|
||||
@endDocuBlock
|
||||
|
Loading…
Reference in New Issue