mirror of https://gitee.com/bigwinds/arangodb
568 lines
59 KiB
JSON
568 lines
59 KiB
JSON
{
|
|
"basePath": "/",
|
|
"swaggerVersion": "1.1",
|
|
"apiVersion": "0.1",
|
|
"apis": [
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query specification. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents matching a given example, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <li><em>example</em>: an example document. The example must contain a value for each attribute in the index. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Skiplist index",
|
|
"httpMethod": "PUT",
|
|
"examples": "",
|
|
"nickname": "SkiplistIndex"
|
|
}
|
|
],
|
|
"path": "/_api/simple/by-example-skiplist"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. The same error code is also returned if an invalid index id or type is used. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query specification. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents matching a given condition, using the specified skiplist index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>index</em>: The id of the index to be used for the query. The index must exist and must be of type <em>skiplist</em>. <li><em>condition</em>: the condition which all returned documents shall satisfy. Conditions must be specified for all indexed attributes. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal number of documents to return. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": "Query by-condition using Skiplist index",
|
|
"httpMethod": "PUT",
|
|
"examples": "",
|
|
"nickname": "QueryBy-conditionUsingSkiplistIndex"
|
|
}
|
|
],
|
|
"path": "/_api/simple/by-condition-skiplist"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> Returns all documents of a collections. The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Return all",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Limit the amount of documents using <em>limit</em> <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"skip\": 2, \"limit\" : 2 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1465263157\", \n \"_key\" : \"1465263157\", \n \"_rev\" : \"1465263157\", \n \"Hello2\" : \"World2\" \n }, \n { \n \"_id\" : \"products/1465590837\", \n \"_key\" : \"1465590837\", \n \"_rev\" : \"1465590837\", \n \"Hello3\" : \"World3\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> Using a <em>batchSize</em> value <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/all <<EOF\n{ \"collection\": \"products\", \"batchSize\" : 3 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1468277813\", \n \"_key\" : \"1468277813\", \n \"_rev\" : \"1468277813\", \n \"Hello5\" : \"World5\" \n }, \n { \n \"_id\" : \"products/1467950133\", \n \"_key\" : \"1467950133\", \n \"_rev\" : \"1467950133\", \n \"Hello4\" : \"World4\" \n }, \n { \n \"_id\" : \"products/1466967093\", \n \"_key\" : \"1466967093\", \n \"_rev\" : \"1466967093\", \n \"Hello1\" : \"World1\" \n } \n ], \n \"hasMore\" : true, \n \"id\" : \"1468474421\", \n \"count\" : 5, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "ReturnAll"
|
|
}
|
|
],
|
|
"path": "/_api/simple/all"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> Returns a random document from a collection. The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The identifier or name of the collection to query. </ul> Returns a JSON object with the document stored in the attribute <em>document</em> if the collection contains at least one document. If the collection is empty, the <em>document</em> attrbute contains null. <br><br>",
|
|
"summary": " Random document",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/any <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/1469260853\", \n \"_key\" : \"1469260853\", \n \"_rev\" : \"1469260853\", \n \"Hello2\" : \"World2\" \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "RandomDocument"
|
|
}
|
|
],
|
|
"path": "/_api/simple/any"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> The default will find at most 100 documents near the given coordinate. The returned array is sorted according to the distance, with the nearest document being first in the return array. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. <br><br> In order to use the <em>near</em> operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the <em>geo</em> field to select a particular index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>latitude</em>: The latitude of the coordinate. <li><em>longitude</em>: The longitude of the coordinate. <li><em>distance</em>: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. The default is 100. (optional) <li><em>geo</em>: If given, the identifier of the geo-index to use. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Near query",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Without distance: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1472341045\", \n \"_key\" : \"1472341045\", \n \"_rev\" : \"1472341045\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/1471947829\", \n \"_key\" : \"1471947829\", \n \"_rev\" : \"1471947829\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> With distance: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1474962485\", \n \"_key\" : \"1474962485\", \n \"_rev\" : \"1474962485\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ], \n \"distance\" : 222.38985328911744 \n }, \n { \n \"_id\" : \"products/1475355701\", \n \"_key\" : \"1475355701\", \n \"_rev\" : \"1475355701\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ], \n \"distance\" : 222.38985328911744 \n }, \n { \n \"_id\" : \"products/1474765877\", \n \"_key\" : \"1474765877\", \n \"_rev\" : \"1474765877\", \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ], \n \"distance\" : 444.779706578235 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "NearQuery"
|
|
}
|
|
],
|
|
"path": "/_api/simple/near"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents within a given radius around the coordinate (<em>latitude</em>, <em>longitude</em>). The returned list is sorted by distance. <br><br> In order to use the <em>within</em> operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the <em>geo</em> field to select a particular index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>latitude</em>: The latitude of the coordinate. <li><em>longitude</em>: The longitude of the coordinate. <li><em>radius</em>: The maximal radius (in meters). <li><em>distance</em>: If given, the attribute key used to return the distance to the given coordinate. (optional). If specified, distances are returned in meters. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. The default is 100. (optional) <li><em>geo</em>: If given, the identifier of the geo-index to use. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Within query",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Without distance: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 2, \"radius\" : 500 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1478370357\", \n \"_key\" : \"1478370357\", \n \"_rev\" : \"1478370357\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/1477977141\", \n \"_key\" : \"1477977141\", \n \"_rev\" : \"1477977141\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> With distance: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/near <<EOF\n{ \"collection\": \"products\", \"latitude\" : 0, \"longitude\" : 0, \"skip\" : 1, \"limit\" : 3, \"distance\" : \"distance\", \"radius\" : 300 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1480991797\", \n \"_key\" : \"1480991797\", \n \"_rev\" : \"1480991797\", \n \"name\" : \"Name/-0.002/\", \n \"loc\" : [ \n -0.002, \n 0 \n ], \n \"distance\" : 222.38985328911744 \n }, \n { \n \"_id\" : \"products/1481385013\", \n \"_key\" : \"1481385013\", \n \"_rev\" : \"1481385013\", \n \"name\" : \"Name/0.002/\", \n \"loc\" : [ \n 0.002, \n 0 \n ], \n \"distance\" : 222.38985328911744 \n }, \n { \n \"_id\" : \"products/1480795189\", \n \"_key\" : \"1480795189\", \n \"_rev\" : \"1480795189\", \n \"name\" : \"Name/-0.004/\", \n \"loc\" : [ \n -0.004, \n 0 \n ], \n \"distance\" : 444.779706578235 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 3, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "WithinQuery"
|
|
}
|
|
],
|
|
"path": "/_api/simple/within"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents within the specified rectangle (determined by the given coordinates (<em>latitude1</em>, <em>longitude1</em>, <em>latitude2</em>, <em>longitude2</em>). <br><br> In order to use the <em>within-rectangle</em> query, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more than one geo-spatial index, you can use the <em>geo</em> field to select a particular index. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>latitude1</em>: The latitude of the first rectangle coordinate. <li><em>longitude1</em>: The longitude of the first rectangle coordinate. <li><em>latitude2</em>: The latitude of the second rectangle coordinate. <li><em>longitude2</em>: The longitude of the second rectangle coordinate. <li><em>skip</em>: The number of documents to skip in the query. (optional) <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. The default is 100. (optional) <li><em>geo</em>: If given, the identifier of the geo-index to use. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Within rectangle query",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/within-rectangle <<EOF\n{\"collection\":\"products\",\"latitude1\":0,\"longitude1\":0,\"latitude2\":0.2,\"longitude2\":0.2,\"skip\":1,\"limit\":2}\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1484989493\", \n \"_key\" : \"1484989493\", \n \"_rev\" : \"1484989493\", \n \"name\" : \"Name/0.008/\", \n \"loc\" : [ \n 0.008, \n 0 \n ] \n }, \n { \n \"_id\" : \"products/1484792885\", \n \"_key\" : \"1484792885\", \n \"_rev\" : \"1484792885\", \n \"name\" : \"Name/0.006/\", \n \"loc\" : [ \n 0.006, \n 0 \n ] \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "WithinRectangleQuery"
|
|
}
|
|
],
|
|
"path": "/_api/simple/within-rectangle"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents from the collection that match the fulltext query specified in <em>query</em>. <br><br> In order to use the <em>fulltext</em> operator, a fulltext index must be defined for the collection and the specified attribute. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>attribute</em>: The attribute that contains the texts. <li><em>query</em>: The fulltext query. Please refer to [Fulltext queries](../SimpleQueries/FulltextQueries.html) for details. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) <li><em>index</em>: The identifier of the fulltext-index to use. </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Fulltext index query",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/fulltext <<EOF\n{ \"collection\": \"products\", \"attribute\" : \"text\", \"query\" : \"word\" }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1486169141\", \n \"_key\" : \"1486169141\", \n \"_rev\" : \"1486169141\", \n \"text\" : \"this text also has a word\" \n }, \n { \n \"_id\" : \"products/1485972533\", \n \"_key\" : \"1485972533\", \n \"_rev\" : \"1485972533\", \n \"text\" : \"this text contains word\" \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "FulltextIndexQuery"
|
|
}
|
|
],
|
|
"path": "/_api/simple/fulltext"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "String",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents matching a given example. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>example</em>: The example document. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Simple query by-example",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Matching an attribute: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1488135221\", \n \"_key\" : \"1488135221\", \n \"_rev\" : \"1488135221\", \n \"i\" : 1 \n }, \n { \n \"_id\" : \"products/1487545397\", \n \"_key\" : \"1487545397\", \n \"_rev\" : \"1487545397\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/1487873077\", \n \"_key\" : \"1487873077\", \n \"_rev\" : \"1487873077\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/1488331829\", \n \"_key\" : \"1488331829\", \n \"_rev\" : \"1488331829\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 4, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> Matching an attribute which is a sub-document: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a.j\" : 1 } }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1489511477\", \n \"_key\" : \"1489511477\", \n \"_rev\" : \"1489511477\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/1489839157\", \n \"_key\" : \"1489839157\", \n \"_rev\" : \"1489839157\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br> Matching an attribute within a sub-document: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1491805237\", \n \"_key\" : \"1491805237\", \n \"_rev\" : \"1491805237\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"hasMore\" : false, \n \"count\" : 1, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "SimpleQueryBy-example"
|
|
}
|
|
],
|
|
"path": "/_api/simple/by-example"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned when the query was successfully executed. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will return the first document matching a given example. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>example</em>: The example document. </ul> Returns a result containing the document or <em>HTTP 404</em> if no document matched the example. <br><br> If more than one document in the collection matches the specified example, only one of these documents will be returned, and it is undefined which of the matching documents is returned. <br><br>",
|
|
"summary": " Document matching an example",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> If a matching document was found: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"i\" : 1 } }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"document\" : { \n \"_id\" : \"products/1494230069\", \n \"_key\" : \"1494230069\", \n \"_rev\" : \"1494230069\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> If no document was found: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"l\" : 1 } }\nEOF\n\nHTTP/1.1 404 Not Found\ncontent-type: application/json; charset=utf-8\n\n{ \n \"error\" : true, \n \"code\" : 404, \n \"errorNum\" : 404, \n \"errorMessage\" : \"no match\" \n}\n</code></pre><br><br><br>",
|
|
"nickname": "DocumentMatchingAnExample"
|
|
}
|
|
],
|
|
"path": "/_api/simple/first-example"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned when the query was successfully executed. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will return the first document(s) from the collection, in the order of insertion/update time. When the <em>count</em> argument is supplied, the result will be an array of documents, with the \"oldest\" document being first in the result array. If the <em>count</em> argument is not supplied, the result is the \"oldest\" document of the collection, or <em>null</em> if the collection is empty. <br><br> The request body must be a JSON object with the following attributes: <ul class=\"swagger-list\"><li><em>collection</em>: the name of the collection <li><em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. </ul> Note: this method is not supported for sharded collections with more than one shard. <br><br>",
|
|
"summary": " First document of a collection",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Retrieving the first n documents: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first <<EOF\n{ \"collection\": \"products\", \"count\" : 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1497244725\", \n \"_key\" : \"1497244725\", \n \"_rev\" : \"1497244725\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n { \n \"_id\" : \"products/1497572405\", \n \"_key\" : \"1497572405\", \n \"_rev\" : \"1497572405\", \n \"i\" : 1, \n \"a\" : { \n \"j\" : 1 \n } \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Retrieving the first document: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/first <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/1498883125\", \n \"_key\" : \"1498883125\", \n \"_rev\" : \"1498883125\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 1, \n \"j\" : 1 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "FirstDocumentOfACollection"
|
|
}
|
|
],
|
|
"path": "/_api/simple/first"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned when the query was successfully executed. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will return the last documents from the collection, in the order of insertion/update time. When the <em>count</em> argument is supplied, the result will be an array of documents, with the \"latest\" document being first in the result array. <br><br> The request body must be a JSON object with the following attributes: <ul class=\"swagger-list\"><li><em>collection</em>: the name of the collection <li><em>count</em>: the number of documents to return at most. Specifiying count is optional. If it is not specified, it defaults to 1. </ul> If the <em>count</em> argument is not supplied, the result is the \"latest\" document of the collection, or <em>null</em> if the collection is empty. <br><br> Note: this method is not supported for sharded collections with more than one shard. <br><br>",
|
|
"summary": " Last document of a collection",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br> Retrieving the last n documents: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last <<EOF\n{ \"collection\": \"products\", \"count\" : 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1501307957\", \n \"_key\" : \"1501307957\", \n \"_rev\" : \"1501307957\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n { \n \"_id\" : \"products/1501111349\", \n \"_key\" : \"1501111349\", \n \"_rev\" : \"1501111349\", \n \"i\" : 1 \n } \n ], \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br> Retrieving the first document: <br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/last <<EOF\n{ \"collection\": \"products\" }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : { \n \"_id\" : \"products/1502946357\", \n \"_key\" : \"1502946357\", \n \"_rev\" : \"1502946357\", \n \"i\" : 1, \n \"a\" : { \n \"k\" : 2, \n \"j\" : 2 \n } \n }, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "LastDocumentOfACollection"
|
|
}
|
|
],
|
|
"path": "/_api/simple/last"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "201"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown or no suitable index for the range query is present. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to query. <li><em>attribute</em>: The attribute path to check. <li><em>left</em>: The lower bound. <li><em>right</em>: The upper bound. <li><em>closed</em>: If <em>true</em>, use interval including <em>left</em> and <em>right</em>, otherwise exclude <em>right</em>, but include <em>left</em>. <li><em>skip</em>: The number of documents to skip in the query (optional). <li><em>limit</em>: The maximal amount of documents to return. The <em>skip</em> is applied before the <em>limit</em> restriction. (optional) </ul> Returns a cursor containing the result, see [Http Cursor](../HttpAqlQueryCursor/README.md) for details. <br><br>",
|
|
"summary": " Simple range query",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/range <<EOF\n{ \"collection\": \"products\", \"attribute\" : \"i\", \"left\" : 2, \"right\" : 4 }\nEOF\n\nHTTP/1.1 201 Created\ncontent-type: application/json; charset=utf-8\n\n{ \n \"result\" : [ \n { \n \"_id\" : \"products/1503929397\", \n \"_key\" : \"1503929397\", \n \"_rev\" : \"1503929397\", \n \"i\" : 2 \n }, \n { \n \"_id\" : \"products/1504126005\", \n \"_key\" : \"1504126005\", \n \"_rev\" : \"1504126005\", \n \"i\" : 3 \n } \n ], \n \"hasMore\" : false, \n \"count\" : 2, \n \"error\" : false, \n \"code\" : 201 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "SimpleRangeQuery"
|
|
}
|
|
],
|
|
"path": "/_api/simple/range"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents in the collection that match the specified example object. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to remove from. <li><em>example</em>: An example document that all collection documents are compared against. <li>options: an json object which can contains following attributes: <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to delete at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be deleted. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br> Returns the number of documents that were deleted. <br><br>",
|
|
"summary": " Remove documents by example",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } } }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br>Using Parameter: waitForSync and limit<br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } },\"waitForSync\": true, \"limit\": 2 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br>Using Parameter: waitForSync and limit with new signature<br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/remove-by-example <<EOF\n{\"collection\": \"products\",\"example\" : { \"a\" : { \"j\" : 1 } },\"options\": {\"waitForSync\": true, \"limit\": 2} }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"deleted\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "RemoveDocumentsByExample"
|
|
}
|
|
],
|
|
"path": "/_api/simple/remove-by-example"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the query was executed successfully. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents in the collection that match the specified example object, and replace the entire document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to replace within. <li><em>example</em>: An example document that all collection documents are compared against. <li><em>newValue</em>: The replacement document that will get inserted in place of the \"old\" documents. <li><em>options</em>: an json object which can contain following attributes <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to replace at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be replaced. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br> Returns the number of documents that were replaced. <br><br>",
|
|
"summary": " Replace documents by example",
|
|
"httpMethod": "PUT",
|
|
"examples": "<br><br><br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"limit\" : 3 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"replaced\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br>Using new Signature for attributes WaitForSync and limit<br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/replace-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : {\"foo\" : \"bar\"}, \"options\": {\"limit\" : 3, \"waitForSync\": true }}\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"replaced\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "ReplaceDocumentsByExample"
|
|
}
|
|
],
|
|
"path": "/_api/simple/replace-by-example"
|
|
},
|
|
{
|
|
"operations": [
|
|
{
|
|
"errorResponses": [
|
|
{
|
|
"reason": "is returned if the collection was updated successfully and <em>waitForSync</em> was <em>true</em>. <br><br>",
|
|
"code": "200"
|
|
},
|
|
{
|
|
"reason": "is returned if the body does not contain a valid JSON representation of a query. The response body contains an error document in this case. <br><br>",
|
|
"code": "400"
|
|
},
|
|
{
|
|
"reason": "is returned if the collection specified by <em>collection</em> is unknown. The response body contains an error document in this case. <br><br>",
|
|
"code": "404"
|
|
}
|
|
],
|
|
"parameters": [
|
|
{
|
|
"dataType": "Json",
|
|
"paramType": "body",
|
|
"required": true,
|
|
"name": "query",
|
|
"description": "Contains the query. <br><br>"
|
|
}
|
|
],
|
|
"notes": "<br><br> This will find all documents in the collection that match the specified example object, and partially update the document body with the new value specified. Note that document meta-attributes such as <em>_id</em>, <em>_key</em>, <em>_from</em>, <em>_to</em> etc. cannot be replaced. <br><br> The call expects a JSON object as body with the following attributes: <br><br> <ul class=\"swagger-list\"><li><em>collection</em>: The name of the collection to update within. <li><em>example</em>: An example document that all collection documents are compared against. <li><em>newValue</em>: A document containing all the attributes to update in the found documents. <li><em>options</em>: a json object wich can contains following attributes: <li><em>keepNull</em>: This parameter can be used to modify the behavior when handling <em>null</em> values. Normally, <em>null</em> values are stored in the database. By setting the <em>keepNull</em> parameter to <em>false</em>, this behavior can be changed so that all attributes in <em>data</em> with <em>null</em> values will be removed from the updated document. <li><em>waitForSync</em>: if set to true, then all removal operations will instantly be synchronised to disk. If this is not specified, then the collection's default sync behavior will be applied. <li><em>limit</em>: an optional value that determines how many documents to update at most. If <em>limit</em> is specified but is less than the number of documents in the collection, it is undefined which of the documents will be updated. </ul> Note: the <em>limit</em> attribute is not supported on sharded collections. Using it will result in an error. <br><br> Returns the number of documents that were updated. <br><br> <br><br>",
|
|
"summary": " Update documents by example",
|
|
"httpMethod": "PUT",
|
|
"examples": "using old syntax for options<br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"limit\" : 3 }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"updated\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br>using new signature for options<br><br><pre><code class=\"json\">shell> curl -X PUT --data-binary @- --dump - http://localhost:8529/_api/simple/update-by-example <<EOF\n{ \"collection\": \"products\", \"example\" : { \"a\" : { \"j\" : 1 } }, \"newValue\" : { \"a\" : { \"j\" : 22 } }, \"options\" : { \"limit\" : 3, \"waitForSync\": true } }\nEOF\n\nHTTP/1.1 200 OK\ncontent-type: application/json; charset=utf-8\n\n{ \n \"updated\" : 1, \n \"error\" : false, \n \"code\" : 200 \n}\n</code></pre><br><br><br>",
|
|
"nickname": "UpdateDocumentsByExample"
|
|
}
|
|
],
|
|
"path": "/_api/simple/update-by-example"
|
|
}
|
|
]
|
|
}
|