mirror of https://gitee.com/bigwinds/arangodb
fixed duplicate name
This commit is contained in:
parent
e7b3377ccb
commit
cd4cd4f97c
|
@ -1,123 +1,121 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
@startDocuBlock REST_DOCUMENT_DELETE
|
||||||
/// @startDocuBlock REST_DOCUMENT_DELETE
|
@brief removes a document
|
||||||
/// @brief removes a document
|
|
||||||
///
|
@RESTHEADER{DELETE /_api/document/{document-handle}, Removes a document}
|
||||||
/// @RESTHEADER{DELETE /_api/document/{document-handle}, Removes a document}
|
|
||||||
///
|
@RESTURLPARAMETERS
|
||||||
/// @RESTURLPARAMETERS
|
|
||||||
///
|
@RESTURLPARAM{document-handle,string,required}
|
||||||
/// @RESTURLPARAM{document-handle,string,required}
|
Removes the document identified by *document-handle*.
|
||||||
/// Removes the document identified by *document-handle*.
|
|
||||||
///
|
@RESTQUERYPARAMETERS
|
||||||
/// @RESTQUERYPARAMETERS
|
|
||||||
///
|
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||||
/// @RESTQUERYPARAM{waitForSync,boolean,optional}
|
Wait until deletion operation has been synced to disk.
|
||||||
/// Wait until deletion operation has been synced to disk.
|
|
||||||
///
|
@RESTQUERYPARAM{returnOld,boolean,optional}
|
||||||
/// @RESTQUERYPARAM{returnOld,boolean,optional}
|
Return additionally the complete previous revision of the changed
|
||||||
/// Return additionally the complete previous revision of the changed
|
document under the attribute *old* in the result.
|
||||||
/// document under the attribute *old* in the result.
|
|
||||||
///
|
@RESTHEADERPARAMETERS
|
||||||
/// @RESTHEADERPARAMETERS
|
|
||||||
///
|
@RESTHEADERPARAM{If-Match,string,optional}
|
||||||
/// @RESTHEADERPARAM{If-Match,string,optional}
|
You can conditionally remove a document based on a target revision id by
|
||||||
/// You can conditionally remove a document based on a target revision id by
|
using the *if-match* HTTP header.
|
||||||
/// using the *if-match* HTTP header.
|
|
||||||
///
|
@RESTDESCRIPTION
|
||||||
/// @RESTDESCRIPTION
|
The body of the response contains a JSON object with the information
|
||||||
/// The body of the response contains a JSON object with the information
|
about the handle and the revision. The attribute *_id* contains the
|
||||||
/// about the handle and the revision. The attribute *_id* contains the
|
known *document-handle* of the removed document, *_key* contains the
|
||||||
/// known *document-handle* of the removed document, *_key* contains the
|
key which uniquely identifies a document in a given collection, and
|
||||||
/// key which uniquely identifies a document in a given collection, and
|
the attribute *_rev* contains the document revision.
|
||||||
/// the attribute *_rev* contains the document revision.
|
|
||||||
///
|
If the *waitForSync* parameter is not specified or set to *false*,
|
||||||
/// If the *waitForSync* parameter is not specified or set to *false*,
|
then the collection's default *waitForSync* behavior is applied.
|
||||||
/// then the collection's default *waitForSync* behavior is applied.
|
The *waitForSync* query parameter cannot be used to disable
|
||||||
/// The *waitForSync* query parameter cannot be used to disable
|
synchronization for collections that have a default *waitForSync*
|
||||||
/// synchronization for collections that have a default *waitForSync*
|
value of *true*.
|
||||||
/// value of *true*.
|
|
||||||
///
|
If the query parameter *returnOld* is *true*, then
|
||||||
/// If the query parameter *returnOld* is *true*, then
|
the complete previous revision of the document
|
||||||
/// the complete previous revision of the document
|
is returned under the *old* attribute in the result.
|
||||||
/// is returned under the *old* attribute in the result.
|
|
||||||
///
|
@RESTRETURNCODES
|
||||||
/// @RESTRETURNCODES
|
|
||||||
///
|
@RESTRETURNCODE{200}
|
||||||
/// @RESTRETURNCODE{200}
|
is returned if the document was removed successfully and
|
||||||
/// is returned if the document was removed successfully and
|
*waitForSync* was *true*.
|
||||||
/// *waitForSync* was *true*.
|
|
||||||
///
|
@RESTRETURNCODE{202}
|
||||||
/// @RESTRETURNCODE{202}
|
is returned if the document was removed successfully and
|
||||||
/// is returned if the document was removed successfully and
|
*waitForSync* was *false*.
|
||||||
/// *waitForSync* was *false*.
|
|
||||||
///
|
@RESTRETURNCODE{404}
|
||||||
/// @RESTRETURNCODE{404}
|
is returned if the collection or the document was not found.
|
||||||
/// is returned if the collection or the document was not found.
|
The response body contains an error document in this case.
|
||||||
/// The response body contains an error document in this case.
|
|
||||||
///
|
@RESTRETURNCODE{412}
|
||||||
/// @RESTRETURNCODE{412}
|
is returned if a "If-Match" header or *rev* is given and the found
|
||||||
/// 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 has a different version. The response will also contain the found
|
document's current revision in the *_rev* attribute. Additionally, the
|
||||||
/// document's current revision in the *_rev* attribute. Additionally, the
|
attributes *_id* and *_key* will be returned.
|
||||||
/// attributes *_id* and *_key* will be returned.
|
|
||||||
///
|
@EXAMPLES
|
||||||
/// @EXAMPLES
|
|
||||||
///
|
Using document handle:
|
||||||
/// Using document handle:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocument}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocument}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn, { waitForSync: true });
|
||||||
/// db._create(cn, { waitForSync: true });
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
|
||||||
///
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url);
|
||||||
/// var response = logCurlRequest('DELETE', url);
|
|
||||||
///
|
assert(response.code === 200);
|
||||||
/// assert(response.code === 200);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
|
||||||
///
|
Unknown document handle:
|
||||||
/// Unknown document handle:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentUnknownHandle}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentUnknownHandle}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn, { waitForSync: true });
|
||||||
/// db._create(cn, { waitForSync: true });
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
db.products.remove(document._id);
|
||||||
/// db.products.remove(document._id);
|
|
||||||
///
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url);
|
||||||
/// var response = logCurlRequest('DELETE', url);
|
|
||||||
///
|
assert(response.code === 404);
|
||||||
/// assert(response.code === 404);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
|
||||||
///
|
Revision conflict:
|
||||||
/// Revision conflict:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentIfMatchOther}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentIfMatchOther}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn);
|
||||||
/// db._create(cn);
|
|
||||||
///
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
var document2 = db.products.save({"hello2":"world"});
|
||||||
/// var document2 = db.products.save({"hello2":"world"});
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
var headers = {"If-Match": "\"" + document2._rev + "\""};
|
||||||
/// var headers = {"If-Match": "\"" + document2._rev + "\""};
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url, "", headers);
|
||||||
/// var response = logCurlRequest('DELETE', url, "", headers);
|
|
||||||
///
|
assert(response.code === 412);
|
||||||
/// assert(response.code === 412);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
@endDocuBlock
|
||||||
/// @endDocuBlock
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
|
@ -1,138 +1,136 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
@startDocuBlock REST_DOCUMENT_DELETE_MULTI
|
||||||
/// @startDocuBlock REST_DOCUMENT_DELETE_MULTI
|
@brief removes multiple document
|
||||||
/// @brief removes multiple document
|
|
||||||
///
|
@RESTHEADER{DELETE /_api/document/{collection},Removes multiple documents}
|
||||||
/// @RESTHEADER{DELETE /_api/document/{collection},Removes multiple documents}
|
|
||||||
///
|
@RESTALLBODYPARAM{array,json,required}
|
||||||
/// @RESTALLBODYPARAM{array,json,required}
|
A JSON array of strings or documents.
|
||||||
/// A JSON array of strings or documents.
|
|
||||||
///
|
@RESTURLPARAMETERS
|
||||||
/// @RESTURLPARAMETERS
|
|
||||||
///
|
@RESTURLPARAM{collection,string,required}
|
||||||
/// @RESTURLPARAM{collection,string,required}
|
Collection from which documents are removed.
|
||||||
/// Collection from which documents are removed.
|
|
||||||
///
|
@RESTURLPARAMETERS
|
||||||
/// @RESTURLPARAMETERS
|
|
||||||
///
|
@RESTQUERYPARAMETERS
|
||||||
/// @RESTQUERYPARAMETERS
|
|
||||||
///
|
@RESTQUERYPARAM{waitForSync,boolean,optional}
|
||||||
/// @RESTQUERYPARAM{waitForSync,boolean,optional}
|
Wait until deletion operation has been synced to disk.
|
||||||
/// Wait until deletion operation has been synced to disk.
|
|
||||||
///
|
@RESTQUERYPARAM{returnOld,boolean,optional}
|
||||||
/// @RESTQUERYPARAM{returnOld,boolean,optional}
|
Return additionally the complete previous revision of the changed
|
||||||
/// Return additionally the complete previous revision of the changed
|
document under the attribute *old* in the result.
|
||||||
/// document under the attribute *old* in the result.
|
|
||||||
///
|
@RESTQUERYPARAM{ignoreRevs,boolean,optional}
|
||||||
/// @RESTQUERYPARAM{ignoreRevs,boolean,optional}
|
If set to *true*, ignore any *_rev* attribute in the selectors. No
|
||||||
/// If set to *true*, ignore any *_rev* attribute in the selectors. No
|
revision check is performed.
|
||||||
/// revision check is performed.
|
|
||||||
///
|
@RESTDESCRIPTION
|
||||||
/// @RESTDESCRIPTION
|
The body of the request is an array consisting of selectors for
|
||||||
/// The body of the request is an array consisting of selectors for
|
documents. A selector can either be a string with a key or a string
|
||||||
/// documents. A selector can either be a string with a key or a string
|
with a document handle or an object with a *_key* attribute. This
|
||||||
/// with a document handle or an object with a *_key* attribute. This
|
API call removes all specified documents from *collection*. If the
|
||||||
/// API call removes all specified documents from *collection*. If the
|
selector is an object and has a *_rev* attribute, it is a
|
||||||
/// selector is an object and has a *_rev* attribute, it is a
|
precondition that the actual revision of the removed document in the
|
||||||
/// precondition that the actual revision of the removed document in the
|
collection is the specified one.
|
||||||
/// collection is the specified one.
|
|
||||||
///
|
The body of the response is an array of the same length as the input
|
||||||
/// The body of the response is an array of the same length as the input
|
array. For each input selector, the output contains a JSON object
|
||||||
/// array. For each input selector, the output contains a JSON object
|
with the information about the outcome of the operation. If no error
|
||||||
/// with the information about the outcome of the operation. If no error
|
occurred, an object is built in which the attribute *_id* contains
|
||||||
/// occurred, an object is built in which the attribute *_id* contains
|
the known *document-handle* of the removed document, *_key* contains
|
||||||
/// the known *document-handle* of the removed document, *_key* contains
|
the key which uniquely identifies a document in a given collection,
|
||||||
/// the key which uniquely identifies a document in a given collection,
|
and the attribute *_rev* contains the document revision. In case of
|
||||||
/// and the attribute *_rev* contains the document revision. In case of
|
an error, an object with the attribute *error* set to *true* and
|
||||||
/// an error, an object with the attribute *error* set to *true* and
|
*errorCode* set to the error code is built.
|
||||||
/// *errorCode* set to the error code is built.
|
|
||||||
///
|
If the *waitForSync* parameter is not specified or set to *false*,
|
||||||
/// If the *waitForSync* parameter is not specified or set to *false*,
|
then the collection's default *waitForSync* behavior is applied.
|
||||||
/// then the collection's default *waitForSync* behavior is applied.
|
The *waitForSync* query parameter cannot be used to disable
|
||||||
/// The *waitForSync* query parameter cannot be used to disable
|
synchronization for collections that have a default *waitForSync*
|
||||||
/// synchronization for collections that have a default *waitForSync*
|
value of *true*.
|
||||||
/// value of *true*.
|
|
||||||
///
|
If the query parameter *returnOld* is *true*, then
|
||||||
/// If the query parameter *returnOld* is *true*, then
|
the complete previous revision of the document
|
||||||
/// the complete previous revision of the document
|
is returned under the *old* attribute in the result.
|
||||||
/// is returned under the *old* attribute in the result.
|
|
||||||
///
|
Note that if any precondition is violated or an error occurred with
|
||||||
/// Note that if any precondition is violated or an error occurred with
|
some of the documents, the return code is still 200 or 202, but
|
||||||
/// some of the documents, the return code is still 200 or 202, but
|
the additional HTTP header *X-Arango-Error-Codes* is set, which
|
||||||
/// the additional HTTP header *X-Arango-Error-Codes* is set, which
|
contains a map of the error codes that occurred together with their
|
||||||
/// contains a map of the error codes that occurred together with their
|
multiplicities, as in: *1200:17,1205:10* which means that in 17
|
||||||
/// multiplicities, as in: *1200:17,1205:10* which means that in 17
|
cases the error 1200 "revision conflict" and in 10 cases the error
|
||||||
/// cases the error 1200 "revision conflict" and in 10 cases the error
|
1205 "illegal document handle" has happened.
|
||||||
/// 1205 "illegal document handle" has happened.
|
|
||||||
///
|
@RESTRETURNCODES
|
||||||
/// @RESTRETURNCODES
|
|
||||||
///
|
@RESTRETURNCODE{200}
|
||||||
/// @RESTRETURNCODE{200}
|
is returned if *waitForSync* was *true*.
|
||||||
/// is returned if *waitForSync* was *true*.
|
|
||||||
///
|
@RESTRETURNCODE{202}
|
||||||
/// @RESTRETURNCODE{202}
|
is returned if *waitForSync* was *false*.
|
||||||
/// is returned if *waitForSync* was *false*.
|
|
||||||
///
|
@RESTRETURNCODE{404}
|
||||||
/// @RESTRETURNCODE{404}
|
is returned if the collection was not found.
|
||||||
/// is returned if the collection was not found.
|
The response body contains an error document in this case.
|
||||||
/// The response body contains an error document in this case.
|
|
||||||
///
|
@EXAMPLES
|
||||||
/// @EXAMPLES
|
|
||||||
///
|
Using document handle:
|
||||||
/// Using document handle:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentMulti}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocument}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn, { waitForSync: true });
|
||||||
/// db._create(cn, { waitForSync: true });
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
|
||||||
///
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url);
|
||||||
/// var response = logCurlRequest('DELETE', url);
|
|
||||||
///
|
assert(response.code === 200);
|
||||||
/// assert(response.code === 200);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
|
||||||
///
|
Unknown document handle:
|
||||||
/// Unknown document handle:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentUnknownHandleMulti}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentUnknownHandle}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn, { waitForSync: true });
|
||||||
/// db._create(cn, { waitForSync: true });
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
db.products.remove(document._id);
|
||||||
/// db.products.remove(document._id);
|
|
||||||
///
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url);
|
||||||
/// var response = logCurlRequest('DELETE', url);
|
|
||||||
///
|
assert(response.code === 404);
|
||||||
/// assert(response.code === 404);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
|
||||||
///
|
Revision conflict:
|
||||||
/// Revision conflict:
|
|
||||||
///
|
@EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentIfMatchOtherMulti}
|
||||||
/// @EXAMPLE_ARANGOSH_RUN{RestDocumentHandlerDeleteDocumentIfMatchOther}
|
var cn = "products";
|
||||||
/// var cn = "products";
|
db._drop(cn);
|
||||||
/// db._drop(cn);
|
db._create(cn);
|
||||||
/// db._create(cn);
|
|
||||||
///
|
var document = db.products.save({"hello":"world"});
|
||||||
/// var document = db.products.save({"hello":"world"});
|
var document2 = db.products.save({"hello2":"world"});
|
||||||
/// var document2 = db.products.save({"hello2":"world"});
|
var url = "/_api/document/" + document._id;
|
||||||
/// var url = "/_api/document/" + document._id;
|
var headers = {"If-Match": "\"" + document2._rev + "\""};
|
||||||
/// var headers = {"If-Match": "\"" + document2._rev + "\""};
|
|
||||||
///
|
var response = logCurlRequest('DELETE', url, "", headers);
|
||||||
/// var response = logCurlRequest('DELETE', url, "", headers);
|
|
||||||
///
|
assert(response.code === 412);
|
||||||
/// assert(response.code === 412);
|
|
||||||
///
|
logJsonResponse(response);
|
||||||
/// logJsonResponse(response);
|
~ db._drop(cn);
|
||||||
/// ~ db._drop(cn);
|
@END_EXAMPLE_ARANGOSH_RUN
|
||||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
@endDocuBlock
|
||||||
/// @endDocuBlock
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
Loading…
Reference in New Issue