1
0
Fork 0

Doc - Sync external repos 2018-09-26 (#6476)

This commit is contained in:
Simran 2018-10-01 18:12:56 +02:00 committed by sleto-it
parent ed04451739
commit fd1019c51e
159 changed files with 1454 additions and 889 deletions

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/go-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/go-driver.git / docs/Drivers/ -->
# ArangoDB GO Driver - Connection Management # ArangoDB GO Driver - Connection Management
## Failover ## Failover

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/go-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/go-driver.git / docs/Drivers/ -->
# ArangoDB GO Driver - Example requests # ArangoDB GO Driver - Example requests
## Connecting to ArangoDB ## Connecting to ArangoDB

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/go-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/go-driver.git / docs/Drivers/ -->
# ArangoDB GO Driver - Getting Started # ArangoDB GO Driver - Getting Started
## Supported versions ## Supported versions

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/go-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/go-driver.git / docs/Drivers/ -->
# ArangoDB GO Driver # ArangoDB GO Driver
The official [ArangoDB](https://arangodb.com) GO Driver The official [ArangoDB](https://arangodb.com) GO Driver

View File

@ -1,12 +1,17 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# ArangoDB JavaScript Driver - Getting Started # ArangoDB JavaScript Driver - Getting Started
## Compatibility ## Compatibility
ArangoJS is compatible with ArangoDB 3.0 and later. **For using ArangoJS with ArangoJS is compatible with the latest stable version of ArangoDB available at
2.8 or earlier see the upgrade note below.** ArangoJS is tested against the two the time of the driver release.
most-recent releases of ArangoDB 3 (currently 3.2 and 3.3) as well as the most
recent version of 2.8 and the latest development version. The [_arangoVersion_ option](../Reference/Database/README.md)
can be used to tell arangojs to target a specific
ArangoDB version. Depending on the version this will enable or disable certain
methods and change behavior to maintain compatibility with the given version.
The oldest version of ArangoDB supported by arangojs when using this option
is 2.8.0 (using `arangoVersion: 20800`).
The yarn/npm distribution of ArangoJS is compatible with Node.js versions 9.x The yarn/npm distribution of ArangoJS is compatible with Node.js versions 9.x
(latest), 8.x (LTS) and 6.x (LTS). Node.js version support follows (latest), 8.x (LTS) and 6.x (LTS). Node.js version support follows
@ -17,16 +22,10 @@ versions of all modern browsers (Edge, Chrome, Firefox and Safari).
Versions outside this range may be compatible but are not actively supported. Versions outside this range may be compatible but are not actively supported.
**Upgrade note**: If you want to use arangojs with ArangoDB 2.8 or earlier **Note**: Starting with arangojs 6.0.0, all asynchronous functions return
remember to set the appropriate `arangoVersion` option (e.g. `20800` for version promises. If you are using a version of Node.js older than Node.js 6.x LTS
2.8.0). The current default value is `30000` (indicating compatibility with ("Boron") make sure you replace the native `Promise` implementation with a
version 3.0.0 and newer). **The driver will behave differently depending on this substitute like [bluebird](https://github.com/petkaantonov/bluebird)
value when using APIs that have changed between these versions.**
**Upgrade note for 6.0.0**: All asynchronous functions now return promises and
support for node-style callbacks has been removed. If you are using a version of
Node.js older than Node.js 6.x LTS ("Boron") make sure you replace the native
`Promise` implementation with a substitute like [bluebird](https://github.com/petkaantonov/bluebird)
to avoid a known memory leak in older versions of the V8 JavaScript engine. to avoid a known memory leak in older versions of the V8 JavaScript engine.
## Versions ## Versions
@ -35,11 +34,11 @@ The version number of this driver does not indicate supported ArangoDB versions!
This driver uses semantic versioning: This driver uses semantic versioning:
* A change in the bugfix version (e.g. X.Y.0 -> X.Y.1) indicates internal - A change in the bugfix version (e.g. X.Y.0 -> X.Y.1) indicates internal
changes and should always be safe to upgrade. changes and should always be safe to upgrade.
* A change in the minor version (e.g. X.1.Z -> X.2.0) indicates additions and - A change in the minor version (e.g. X.1.Z -> X.2.0) indicates additions and
backwards-compatible changes that should not affect your code. backwards-compatible changes that should not affect your code.
* A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_ - A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
changes that require changes in your code to upgrade. changes that require changes in your code to upgrade.
If you are getting weird errors or functions seem to be missing, make sure you If you are getting weird errors or functions seem to be missing, make sure you
@ -59,27 +58,6 @@ You can find the documentation for each version by clicking on the corresponding
date on the left in date on the left in
[the list of version tags](https://github.com/arangodb/arangojs/tags). [the list of version tags](https://github.com/arangodb/arangojs/tags).
## Testing
Run the tests using the `yarn test` or `npm test` commands:
```sh
yarn test
# - or -
npm test
```
By default the tests will be run against a server listening on
`http://localhost:8529` (using username `root` with no password). To
override this, you can set the environment variable `TEST_ARANGODB_URL` to
something different:
```sh
TEST_ARANGODB_URL=http://myserver.local:8530 yarn test
# - or -
TEST_ARANGODB_URL=http://myserver.local:8530 npm test
```
## Install ## Install
### With Yarn or NPM ### With Yarn or NPM
@ -171,11 +149,10 @@ const db = new Database();
var arangojs = require("arangojs"); var arangojs = require("arangojs");
var db = new arangojs.Database(); var db = new arangojs.Database();
var now = Date.now(); var now = Date.now();
db db.query({
.query({ query: "RETURN @value",
query: "RETURN @value", bindVars: { value: now }
bindVars: { value: now } })
})
.then(function(cursor) { .then(function(cursor) {
return cursor.next().then(function(result) { return cursor.next().then(function(result) {
// ... // ...
@ -213,7 +190,9 @@ AQL queries without making your code vulnerable to injection attacks.
## Error responses ## Error responses
If arangojs encounters an API error, it will throw an _ArangoError_ with an If arangojs encounters an API error, it will throw an _ArangoError_ with an
[_errorNum_ as defined in the ArangoDB documentation](../../..//Manual/Appendix/ErrorCodes.html) as well as a _code_ and _statusCode_ property indicating the intended and actual HTTP status code of the response. [_errorNum_ error code](../../..//Manual/Appendix/ErrorCodes.html)
as well as a _code_ and _statusCode_ property indicating the intended and
actual HTTP status code of the response.
For any other error responses (4xx/5xx status code), it will throw an For any other error responses (4xx/5xx status code), it will throw an
_HttpError_ error with the status code indicated by the _code_ and _statusCode_ properties. _HttpError_ error with the status code indicated by the _code_ and _statusCode_ properties.
@ -224,22 +203,22 @@ not be parsed, a _SyntaxError_ may be thrown instead.
In all of these cases the error object will additionally have a _response_ In all of these cases the error object will additionally have a _response_
property containing the server response object. property containing the server response object.
If the request failed at a network level or the connection was closed without receiving a response, the underlying error will be thrown instead. If the request failed at a network level or the connection was closed without
receiving a response, the underlying error will be thrown instead.
**Examples** **Examples**
```js ```js
// Using async/await // Using async/await
try { try {
const info = await db.createDatabase('mydb'); const info = await db.createDatabase("mydb");
// database created // database created
} catch (err) { } catch (err) {
console.error(err.stack); console.error(err.stack);
} }
// Using promises with arrow functions // Using promises with arrow functions
db.createDatabase('mydb') db.createDatabase("mydb").then(
.then(
info => { info => {
// database created // database created
}, },
@ -247,7 +226,9 @@ db.createDatabase('mydb')
); );
``` ```
**Note**: the examples in the remainder of this documentation use async/await {% hint 'tip' %}
The examples in the remainder of this documentation use `async`/`await`
and other modern language features like multi-line strings and template tags. and other modern language features like multi-line strings and template tags.
When developing for an environment without support for these language features, When developing for an environment without support for these language features,
just use promises instead as in the above example. substitute promises for `await` syntax as in the above example.
{% endhint %}

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# ArangoDB JavaScript Driver # ArangoDB JavaScript Driver
The official ArangoDB low-level JavaScript client. The official ArangoDB low-level JavaScript client.
@ -11,6 +11,6 @@ instead; specifically the `db` object exported by the `@arangodb` module. The
JavaScript driver is **only** meant to be used when accessing ArangoDB from JavaScript driver is **only** meant to be used when accessing ArangoDB from
**outside** the database. **outside** the database.
* [Getting Started](GettingStarted/README.md) - [Getting Started](GettingStarted/README.md)
* [Reference](Reference/README.md) - [Reference](Reference/README.md)
* [Changelog](https://github.com/arangodb/arangojs/blob/master/CHANGELOG.md#readme) - [Changelog](https://github.com/arangodb/arangojs/blob/master/CHANGELOG.md#readme)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Bulk importing documents # Bulk importing documents
This function implements the This function implements the
@ -12,90 +12,140 @@ Bulk imports the given _data_ into the collection.
**Arguments** **Arguments**
* **data**: `Array<Array<any>> | Array<Object>` - **data**: `Array | Buffer | string`
The data to import. This can be an array of documents: The data to import. Depending on the _type_ option this can be any of the
following:
```js For type `"documents"` or `"auto"`:
[
{key1: value1, key2: value2}, // document 1
{key1: value1, key2: value2}, // document 2
...
]
```
Or it can be an array of value arrays following an array of keys. - an array of documents, e.g.
```js ```json
[ [
['key1', 'key2'], // key names { "_key": "banana", "color": "yellow" },
[value1, value2], // document 1 { "_key": "peach", "color": "pink" }
[value1, value2], // document 2 ]
... ```
]
```
* **opts**: `Object` (optional) If _opts_ is set, it must be an object with any - a string or buffer containing one JSON document per line, e.g.
```
{"_key":"banana","color":"yellow"}
{"_key":"peach","color":"pink"}
```
For type `"array"` or `"auto"`:
- a string or buffer containing a JSON array of documents, e.g.
```json
[
{ "_key": "banana", "color": "yellow" },
{ "_key": "peach", "color": "pink" }
]
```
For type `null`:
- an array containing an array of keys followed by arrays of values, e.g.
```
[
["_key", "color"],
["banana", "yellow"],
["peach", "pink"]
]
```
- a string or buffer containing a JSON array of keys followed by
one JSON array of values per line, e.g.
```
["_key", "color"]
["banana", "yellow"]
["peach", "pink"]
```
- **opts**: `Object` (optional) If _opts_ is set, it must be an object with any
of the following properties: of the following properties:
* **waitForSync**: `boolean` (Default: `false`) - **type**: `string | null` (Default: `"auto"`)
Indicates which format the data uses.
Can be `"documents"`, `"array"` or `"auto"`.
Use `null` to explicitly set no type.
- **fromPrefix**: `string` (optional)
Prefix to prepend to `_from` attributes.
- **toPrefix**: `string` (optional)
Prefix to prepend to `_to` attributes.
- **overwrite**: `boolean` (Default: `false`)
If set to `true`, the collection is truncated before the data is imported.
- **waitForSync**: `boolean` (Default: `false`)
Wait until the documents have been synced to disk. Wait until the documents have been synced to disk.
* **details**: `boolean` (Default: `false`) - **onDuplicate**: `string` (Default: `"error"`)
Controls behavior when a unique constraint is violated.
Can be `"error"`, `"update"`, `"replace"` or `"ignore"`.
- **complete**: `boolean` (Default: `false`)
If set to `true`, the import will abort if any error occurs.
- **details**: `boolean` (Default: `false`)
Whether the response should contain additional details about documents that Whether the response should contain additional details about documents that
could not be imported.false\*. could not be imported.
* **type**: `string` (Default: `"auto"`) For more information on the _opts_ object, see the
[HTTP API documentation for bulk imports](../../../..//HTTP/BulkImports/index.html).
Indicates which format the data uses. Can be `"documents"`, `"array"` or
`"auto"`.
If _data_ is a JavaScript array, it will be transmitted as a line-delimited JSON
stream. If _opts.type_ is set to `"array"`, it will be transmitted as regular
JSON instead. If _data_ is a string, it will be transmitted as it is without any
processing.
For more information on the _opts_ object, see
[the HTTP API documentation for bulk imports](../../../..//HTTP/BulkImports/ImportingSelfContained.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('users'); const collection = db.collection("users");
// document stream const result = await collection.import(
const result = await collection.import([ [
{username: 'admin', password: 'hunter2'}, { username: "jcd", password: "bionicman" },
{username: 'jcd', password: 'bionicman'}, { username: "jreyes", password: "amigo" },
{username: 'jreyes', password: 'amigo'}, { username: "ghermann", password: "zeitgeist" }
{username: 'ghermann', password: 'zeitgeist'} ],
]); { type: "documents" } // optional
assert.equal(result.created, 4); );
// -- or -- // -- or --
// array stream with header const buf = fs.readFileSync("dx_users.json");
const result = await collection.import([ // [
['username', 'password'], // keys // {"username": "jcd", "password": "bionicman"},
['admin', 'hunter2'], // row 1 // {"username": "jreyes", "password": "amigo"},
['jcd', 'bionicman'], // row 2 // {"username": "ghermann", "password": "zeitgeist"}
['jreyes', 'amigo'], // ]
['ghermann', 'zeitgeist'] const result = await collection.import(
]); buf,
assert.equal(result.created, 4); { type: "array" } // optional
);
// -- or -- // -- or --
// raw line-delimited JSON array stream with header const result = await collection.import(
const result = await collection.import([ [
'["username", "password"]', ["username", "password"],
'["admin", "hunter2"]', ["jcd", "bionicman"],
'["jcd", "bionicman"]', ["jreyes", "amigo"],
'["jreyes", "amigo"]', ["ghermann", "zeitgeist"]
'["ghermann", "zeitgeist"]' ],
].join('\r\n') + '\r\n'); { type: null } // required
assert.equal(result.created, 4); );
``` ```

View File

@ -1,8 +1,8 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating the collection # Manipulating the collection
These functions implement These functions implement the
[the HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html). [HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
## collection.create ## collection.create
@ -15,8 +15,8 @@ then returns the server response.
- **properties**: `Object` (optional) - **properties**: `Object` (optional)
For more information on the _properties_ object, see For more information on the _properties_ object, see the
[the HTTP API documentation for creating collections](../../../..//HTTP/Collection/Creating.html). [HTTP API documentation for creating collections](../../../..//HTTP/Collection/Creating.html).
**Examples** **Examples**
@ -82,8 +82,8 @@ Replaces the properties of the collection.
- **properties**: `Object` - **properties**: `Object`
For information on the _properties_ argument see For information on the _properties_ argument see the
[the HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html). [HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
**Examples** **Examples**
@ -162,9 +162,10 @@ Deletes the collection from the database.
This parameter must be set to `true` when dropping a system collection. This parameter must be set to `true` when dropping a system collection.
For more information on the _properties_ object, see For more information on the _properties_ object, see the
[the HTTP API documentation for dropping collections](../../../..//HTTP/Collection/Creating.html#drops-a-collection). [HTTP API documentation for dropping collections](../../../..//HTTP/Collection/Creating.html#drops-a-collection).
**Examples**
**Examples**
```js ```js
const db = new Database(); const db = new Database();

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# DocumentCollection API # DocumentCollection API
The _DocumentCollection API_ extends the The _DocumentCollection API_ extends the
@ -131,8 +131,8 @@ the document's metadata.
If a boolean is passed instead of an options object, it will be interpreted as If a boolean is passed instead of an options object, it will be interpreted as
the _returnNew_ option. the _returnNew_ option.
For more information on the _opts_ object, see For more information on the _opts_ object, see the
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html). [HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
**Examples** **Examples**

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating documents # Manipulating documents
These functions implement the These functions implement the
@ -11,56 +11,57 @@ These functions implement the
Replaces the content of the document with the given _documentHandle_ with the Replaces the content of the document with the given _documentHandle_ with the
given _newValue_ and returns an object containing the document's metadata. given _newValue_ and returns an object containing the document's metadata.
**Note**: The _policy_ option is not available when using the driver with
ArangoDB 3.0 as it is redundant when specifying the _rev_ option.
**Arguments** **Arguments**
* **documentHandle**: `string` - **documentHandle**: `string`
The handle of the document to replace. This can either be the `_id` or the The handle of the document to replace. This can either be the `_id` or the
`_key` of a document in the collection, or a document (i.e. an object with an `_key` of a document in the collection, or a document (i.e. an object with an
`_id` or `_key` property). `_id` or `_key` property).
* **newValue**: `Object` - **newValue**: `Object`
The new data of the document. The new data of the document.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
If _opts_ is set, it must be an object with any of the following properties: If _opts_ is set, it must be an object with any of the following properties:
* **waitForSync**: `boolean` (Default: `false`) - **waitForSync**: `boolean` (Default: `false`)
Wait until the document has been synced to disk. Default: `false`. Wait until the document has been synced to disk. Default: `false`.
* **rev**: `string` (optional) - **rev**: `string` (optional)
Only replace the document if it matches this revision. Only replace the document if it matches this revision.
* **policy**: `string` (optional) - **policy**: `string` (optional)
Determines the behaviour when the revision is not matched: {% hint 'warning' %}
This option has no effect in ArangoDB 3.0 and later.
{% endhint %}
* if _policy_ is set to `"last"`, the document will be replaced regardless Determines the behavior when the revision is not matched:
- if _policy_ is set to `"last"`, the document will be replaced regardless
of the revision. of the revision.
* if _policy_ is set to `"error"` or not set, the replacement will fail with - if _policy_ is set to `"error"` or not set, the replacement will fail with
an error. an error.
If a string is passed instead of an options object, it will be interpreted as If a string is passed instead of an options object, it will be interpreted as
the _rev_ option. the _rev_ option.
For more information on the _opts_ object, see For more information on the _opts_ object, see the
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html). [HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const data = {number: 1, hello: 'world'}; const data = { number: 1, hello: "world" };
const info1 = await collection.save(data); const info1 = await collection.save(data);
const info2 = await collection.replace(info1, {number: 2}); const info2 = await collection.replace(info1, { number: 2 });
assert.equal(info2._id, info1._id); assert.equal(info2._id, info1._id);
assert.notEqual(info2._rev, info1._rev); assert.notEqual(info2._rev, info1._rev);
const doc = await collection.document(info1); const doc = await collection.document(info1);
@ -78,83 +79,84 @@ Updates (merges) the content of the document with the given _documentHandle_
with the given _newValue_ and returns an object containing the document's with the given _newValue_ and returns an object containing the document's
metadata. metadata.
**Note**: The _policy_ option is not available when using the driver with
ArangoDB 3.0 as it is redundant when specifying the _rev_ option.
**Arguments** **Arguments**
* **documentHandle**: `string` - **documentHandle**: `string`
Handle of the document to update. This can be either the `_id` or the `_key` Handle of the document to update. This can be either the `_id` or the `_key`
of a document in the collection, or a document (i.e. an object with an `_id` of a document in the collection, or a document (i.e. an object with an `_id`
or `_key` property). or `_key` property).
* **newValue**: `Object` - **newValue**: `Object`
The new data of the document. The new data of the document.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
If _opts_ is set, it must be an object with any of the following properties: If _opts_ is set, it must be an object with any of the following properties:
* **waitForSync**: `boolean` (Default: `false`) - **waitForSync**: `boolean` (Default: `false`)
Wait until document has been synced to disk. Wait until document has been synced to disk.
* **keepNull**: `boolean` (Default: `true`) - **keepNull**: `boolean` (Default: `true`)
If set to `false`, properties with a value of `null` indicate that a If set to `false`, properties with a value of `null` indicate that a
property should be deleted. property should be deleted.
* **mergeObjects**: `boolean` (Default: `true`) - **mergeObjects**: `boolean` (Default: `true`)
If set to `false`, object properties that already exist in the old document If set to `false`, object properties that already exist in the old document
will be overwritten rather than merged. This does not affect arrays. will be overwritten rather than merged. This does not affect arrays.
* **returnOld**: `boolean` (Default: `false`) - **returnOld**: `boolean` (Default: `false`)
If set to `true`, return additionally the complete previous revision of the If set to `true`, return additionally the complete previous revision of the
changed documents under the attribute `old` in the result. changed documents under the attribute `old` in the result.
* **returnNew**: `boolean` (Default: `false`) - **returnNew**: `boolean` (Default: `false`)
If set to `true`, return additionally the complete new documents under the If set to `true`, return additionally the complete new documents under the
attribute `new` in the result. attribute `new` in the result.
* **ignoreRevs**: `boolean` (Default: `true`) - **ignoreRevs**: `boolean` (Default: `true`)
By default, or if this is set to true, the _rev attributes in the given By default, or if this is set to true, the `_rev` attributes in the given
documents are ignored. If this is set to false, then any _rev attribute documents are ignored. If this is set to false, then any `_rev` attribute
given in a body document is taken as a precondition. The document is only given in a body document is taken as a precondition. The document is only
updated if the current revision is the one specified. updated if the current revision is the one specified.
* **rev**: `string` (optional) - **rev**: `string` (optional)
Only update the document if it matches this revision. Only update the document if it matches this revision.
* **policy**: `string` (optional) - **policy**: `string` (optional)
Determines the behaviour when the revision is not matched: {% hint 'warning' %}
This option has no effect in ArangoDB 3.0 and later.
{% endhint %}
* if _policy_ is set to `"last"`, the document will be replaced regardless Determines the behavior when the revision is not matched:
- if _policy_ is set to `"last"`, the document will be replaced regardless
of the revision. of the revision.
* if _policy_ is set to `"error"` or not set, the replacement will fail with - if _policy_ is set to `"error"` or not set, the replacement will fail with
an error. an error.
If a string is passed instead of an options object, it will be interpreted as If a string is passed instead of an options object, it will be interpreted as
the _rev_ option. the _rev_ option.
For more information on the _opts_ object, see For more information on the _opts_ object, see the
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html). [HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const doc = {number: 1, hello: 'world'}; const doc = { number: 1, hello: "world" };
const doc1 = await collection.save(doc); const doc1 = await collection.save(doc);
const doc2 = await collection.update(doc1, {number: 2}); const doc2 = await collection.update(doc1, { number: 2 });
assert.equal(doc2._id, doc1._id); assert.equal(doc2._id, doc1._id);
assert.notEqual(doc2._rev, doc1._rev); assert.notEqual(doc2._rev, doc1._rev);
const doc3 = await collection.document(doc2); const doc3 = await collection.document(doc2);
@ -171,67 +173,69 @@ assert.equal(doc3.hello, doc.hello);
Updates (merges) the content of the documents with the given _documents_ and Updates (merges) the content of the documents with the given _documents_ and
returns an array containing the documents' metadata. returns an array containing the documents' metadata.
**Note**: This method is new in 3.0 and is available when using the driver with {% hint 'info' %}
ArangoDB 3.0 and higher. This method is only available when targeting ArangoDB 3.0 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
**Arguments** **Arguments**
* **documents**: `Array<Object>` - **documents**: `Array<Object>`
Documents to update. Each object must have either the `_id` or the `_key` Documents to update. Each object must have either the `_id` or the `_key`
property. property.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
If _opts_ is set, it must be an object with any of the following properties: If _opts_ is set, it must be an object with any of the following properties:
* **waitForSync**: `boolean` (Default: `false`) - **waitForSync**: `boolean` (Default: `false`)
Wait until document has been synced to disk. Wait until document has been synced to disk.
* **keepNull**: `boolean` (Default: `true`) - **keepNull**: `boolean` (Default: `true`)
If set to `false`, properties with a value of `null` indicate that a If set to `false`, properties with a value of `null` indicate that a
property should be deleted. property should be deleted.
* **mergeObjects**: `boolean` (Default: `true`) - **mergeObjects**: `boolean` (Default: `true`)
If set to `false`, object properties that already exist in the old document If set to `false`, object properties that already exist in the old document
will be overwritten rather than merged. This does not affect arrays. will be overwritten rather than merged. This does not affect arrays.
* **returnOld**: `boolean` (Default: `false`) - **returnOld**: `boolean` (Default: `false`)
If set to `true`, return additionally the complete previous revision of the If set to `true`, return additionally the complete previous revision of the
changed documents under the attribute `old` in the result. changed documents under the attribute `old` in the result.
* **returnNew**: `boolean` (Default: `false`) - **returnNew**: `boolean` (Default: `false`)
If set to `true`, return additionally the complete new documents under the If set to `true`, return additionally the complete new documents under the
attribute `new` in the result. attribute `new` in the result.
* **ignoreRevs**: `boolean` (Default: `true`) - **ignoreRevs**: `boolean` (Default: `true`)
By default, or if this is set to true, the _rev attributes in the given By default, or if this is set to true, the `_rev` attributes in the given
documents are ignored. If this is set to false, then any _rev attribute documents are ignored. If this is set to false, then any `_rev` attribute
given in a body document is taken as a precondition. The document is only given in a body document is taken as a precondition. The document is only
updated if the current revision is the one specified. updated if the current revision is the one specified.
For more information on the _opts_ object, see For more information on the _opts_ object, see the
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html). [HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const doc1 = {number: 1, hello: 'world1'}; const doc1 = { number: 1, hello: "world1" };
const info1 = await collection.save(doc1); const info1 = await collection.save(doc1);
const doc2 = {number: 2, hello: 'world2'}; const doc2 = { number: 2, hello: "world2" };
const info2 = await collection.save(doc2); const info2 = await collection.save(doc2);
const result = await collection.bulkUpdate([ const result = await collection.bulkUpdate(
{_key: info1._key, number: 3}, [{ _key: info1._key, number: 3 }, { _key: info2._key, number: 4 }],
{_key: info2._key, number: 4} { returnNew: true }
], {returnNew: true}) );
``` ```
## collection.remove ## collection.remove
@ -240,56 +244,57 @@ const result = await collection.bulkUpdate([
Deletes the document with the given _documentHandle_ from the collection. Deletes the document with the given _documentHandle_ from the collection.
**Note**: The _policy_ option is not available when using the driver with
ArangoDB 3.0 as it is redundant when specifying the _rev_ option.
**Arguments** **Arguments**
* **documentHandle**: `string` - **documentHandle**: `string`
The handle of the document to delete. This can be either the `_id` or the The handle of the document to delete. This can be either the `_id` or the
`_key` of a document in the collection, or a document (i.e. an object with an `_key` of a document in the collection, or a document (i.e. an object with an
`_id` or `_key` property). `_id` or `_key` property).
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
If _opts_ is set, it must be an object with any of the following properties: If _opts_ is set, it must be an object with any of the following properties:
* **waitForSync**: `boolean` (Default: `false`) - **waitForSync**: `boolean` (Default: `false`)
Wait until document has been synced to disk. Wait until document has been synced to disk.
* **rev**: `string` (optional) - **rev**: `string` (optional)
Only update the document if it matches this revision. Only update the document if it matches this revision.
* **policy**: `string` (optional) - **policy**: `string` (optional)
Determines the behaviour when the revision is not matched: {% hint 'warning' %}
This option has no effect in ArangoDB 3.0 and later.
{% endhint %}
* if _policy_ is set to `"last"`, the document will be replaced regardless Determines the behavior when the revision is not matched:
- if _policy_ is set to `"last"`, the document will be replaced regardless
of the revision. of the revision.
* if _policy_ is set to `"error"` or not set, the replacement will fail with - if _policy_ is set to `"error"` or not set, the replacement will fail with
an error. an error.
If a string is passed instead of an options object, it will be interpreted as If a string is passed instead of an options object, it will be interpreted as
the _rev_ option. the _rev_ option.
For more information on the _opts_ object, see For more information on the _opts_ object, see the
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html). [HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
await collection.remove('some-doc'); await collection.remove("some-doc");
// document 'some-collection/some-doc' no longer exists // document 'some-collection/some-doc' no longer exists
// -- or -- // -- or --
await collection.remove('some-collection/some-doc'); await collection.remove("some-collection/some-doc");
// document 'some-collection/some-doc' no longer exists // document 'some-collection/some-doc' no longer exists
``` ```
@ -301,13 +306,13 @@ Retrieves a list of references for all documents in the collection.
**Arguments** **Arguments**
* **type**: `string` (Default: `"id"`) - **type**: `string` (Default: `"id"`)
The format of the document references: The format of the document references:
* if _type_ is set to `"id"`, each reference will be the `_id` of the - if _type_ is set to `"id"`, each reference will be the `_id` of the
document. document.
* if _type_ is set to `"key"`, each reference will be the `_key` of the - if _type_ is set to `"key"`, each reference will be the `_key` of the
document. document.
* if _type_ is set to `"path"`, each reference will be the URI path of the - if _type_ is set to `"path"`, each reference will be the URI path of the
document. document.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# EdgeCollection API # EdgeCollection API
The _EdgeCollection API_ extends the The _EdgeCollection API_ extends the
@ -79,7 +79,7 @@ if (exists === false) {
## edgeCollection.save ## edgeCollection.save
`async edgeCollection.save(data, [fromId, toId]): Object` `async edgeCollection.save(data, [fromId, toId], [opts]): Object`
Creates a new edge between the documents _fromId_ and _toId_ with the given Creates a new edge between the documents _fromId_ and _toId_ with the given
_data_ and returns an object containing the edge's metadata. _data_ and returns an object containing the edge's metadata.
@ -275,8 +275,8 @@ contained in this edge collection.
- **opts**: `Object` - **opts**: `Object`
See See the
[the HTTP API documentation](../../../..//HTTP/Traversal/index.html) [HTTP API documentation](../../../..//HTTP/Traversal/index.html)
for details on the additional arguments. for details on the additional arguments.
Please note that while _opts.filter_, _opts.visitor_, _opts.init_, Please note that while _opts.filter_, _opts.visitor_, _opts.init_,

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating indexes # Manipulating indexes
These functions implement the These functions implement the
@ -12,17 +12,20 @@ Creates an arbitrary index on the collection.
**Arguments** **Arguments**
* **details**: `Object` - **details**: `Object`
For information on the possible properties of the _details_ object, see For information on the possible properties of the _details_ object, see the
[the HTTP API for manipulating indexes](../../../..//HTTP/Indexes/WorkingWith.html). [HTTP API for manipulating indexes](../../../..//HTTP/Indexes/WorkingWith.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createIndex({type: 'hash', fields: ['a', 'a.b']}); const index = await collection.createIndex({
type: "hash",
fields: ["a", "a.b"]
});
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
``` ```
@ -34,34 +37,34 @@ Creates a hash index on the collection.
**Arguments** **Arguments**
* **fields**: `Array<string>` - **fields**: `Array<string>`
An array of names of document fields on which to create the index. If the An array of names of document fields on which to create the index. If the
value is a string, it will be wrapped in an array automatically. value is a string, it will be wrapped in an array automatically.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
Additional options for this index. If the value is a boolean, it will be Additional options for this index. If the value is a boolean, it will be
interpreted as _opts.unique_. interpreted as _opts.unique_.
For more information on hash indexes, see For more information on hash indexes, see the
[the HTTP API for hash indexes](../../../..//HTTP/Indexes/Hash.html). [HTTP API for hash indexes](../../../..//HTTP/Indexes/Hash.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createHashIndex('favorite-color'); const index = await collection.createHashIndex("favorite-color");
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['favorite-color']); assert.deepEqual(index.fields, ["favorite-color"]);
// -- or -- // -- or --
const index = await collection.createHashIndex(['favorite-color']); const index = await collection.createHashIndex(["favorite-color"]);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['favorite-color']); assert.deepEqual(index.fields, ["favorite-color"]);
``` ```
## collection.createSkipList ## collection.createSkipList
@ -72,34 +75,34 @@ Creates a skiplist index on the collection.
**Arguments** **Arguments**
* **fields**: `Array<string>` - **fields**: `Array<string>`
An array of names of document fields on which to create the index. If the An array of names of document fields on which to create the index. If the
value is a string, it will be wrapped in an array automatically. value is a string, it will be wrapped in an array automatically.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
Additional options for this index. If the value is a boolean, it will be Additional options for this index. If the value is a boolean, it will be
interpreted as _opts.unique_. interpreted as _opts.unique_.
For more information on skiplist indexes, see For more information on skiplist indexes, see the
[the HTTP API for skiplist indexes](../../../..//HTTP/Indexes/Skiplist.html). [HTTP API for skiplist indexes](../../../..//HTTP/Indexes/Skiplist.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createSkipList('favorite-color') const index = await collection.createSkipList("favorite-color");
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['favorite-color']); assert.deepEqual(index.fields, ["favorite-color"]);
// -- or -- // -- or --
const index = await collection.createSkipList(['favorite-color']) const index = await collection.createSkipList(["favorite-color"]);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['favorite-color']); assert.deepEqual(index.fields, ["favorite-color"]);
``` ```
## collection.createGeoIndex ## collection.createGeoIndex
@ -110,34 +113,34 @@ Creates a geo-spatial index on the collection.
**Arguments** **Arguments**
* **fields**: `Array<string>` - **fields**: `Array<string>`
An array of names of document fields on which to create the index. Currently, An array of names of document fields on which to create the index. Currently,
geo indexes must cover exactly one field. If the value is a string, it will be geo indexes must cover exactly one field. If the value is a string, it will be
wrapped in an array automatically. wrapped in an array automatically.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
An object containing additional properties of the index. An object containing additional properties of the index.
For more information on the properties of the _opts_ object see For more information on the properties of the _opts_ object see the
[the HTTP API for manipulating geo indexes](../../../..//HTTP/Indexes/Geo.html). [HTTP API for manipulating geo indexes](../../../..//HTTP/Indexes/Geo.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createGeoIndex(['latitude', 'longitude']); const index = await collection.createGeoIndex(["latitude", "longitude"]);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['longitude', 'latitude']); assert.deepEqual(index.fields, ["longitude", "latitude"]);
// -- or -- // -- or --
const index = await collection.createGeoIndex('location', {geoJson: true}); const index = await collection.createGeoIndex("location", { geoJson: true });
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['location']); assert.deepEqual(index.fields, ["location"]);
``` ```
## collection.createFulltextIndex ## collection.createFulltextIndex
@ -148,13 +151,13 @@ Creates a fulltext index on the collection.
**Arguments** **Arguments**
* **fields**: `Array<string>` - **fields**: `Array<string>`
An array of names of document fields on which to create the index. Currently, An array of names of document fields on which to create the index. Currently,
fulltext indexes must cover exactly one field. If the value is a string, it fulltext indexes must cover exactly one field. If the value is a string, it
will be wrapped in an array automatically. will be wrapped in an array automatically.
* **minLength** (optional): - **minLength** (optional):
Minimum character length of words to index. Uses a server-specific default Minimum character length of words to index. Uses a server-specific default
value if not specified. value if not specified.
@ -166,17 +169,17 @@ For more information on fulltext indexes, see
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createFulltextIndex('description'); const index = await collection.createFulltextIndex("description");
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['description']); assert.deepEqual(index.fields, ["description"]);
// -- or -- // -- or --
const index = await collection.createFulltextIndex(['description']); const index = await collection.createFulltextIndex(["description"]);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['description']); assert.deepEqual(index.fields, ["description"]);
``` ```
## collection.createPersistentIndex ## collection.createPersistentIndex
@ -190,11 +193,11 @@ being that it will always be orders of magnitude slower than in-memory indexes.
**Arguments** **Arguments**
* **fields**: `Array<string>` - **fields**: `Array<string>`
An array of names of document fields on which to create the index. An array of names of document fields on which to create the index.
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
An object containing additional properties of the index. An object containing additional properties of the index.
@ -205,11 +208,11 @@ For more information on the properties of the _opts_ object see
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createPersistentIndex(['name', 'email']); const index = await collection.createPersistentIndex(["name", "email"]);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.deepEqual(index.fields, ['name', 'email']); assert.deepEqual(index.fields, ["name", "email"]);
``` ```
## collection.index ## collection.index
@ -220,7 +223,7 @@ Fetches information about the index with the given _indexHandle_ and returns it.
**Arguments** **Arguments**
* **indexHandle**: `string` - **indexHandle**: `string`
The handle of the index to look up. This can either be a fully-qualified The handle of the index to look up. This can either be a fully-qualified
identifier or the collection-specific key of the index. If the value is an identifier or the collection-specific key of the index. If the value is an
@ -230,15 +233,15 @@ Fetches information about the index with the given _indexHandle_ and returns it.
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createFulltextIndex('description'); const index = await collection.createFulltextIndex("description");
const result = await collection.index(index.id); const result = await collection.index(index.id);
assert.equal(result.id, index.id); assert.equal(result.id, index.id);
// result contains the properties of the index // result contains the properties of the index
// -- or -- // -- or --
const result = await collection.index(index.id.split('/')[1]); const result = await collection.index(index.id.split("/")[1]);
assert.equal(result.id, index.id); assert.equal(result.id, index.id);
// result contains the properties of the index // result contains the properties of the index
``` ```
@ -253,8 +256,8 @@ Fetches a list of all indexes on this collection.
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
await collection.createFulltextIndex('description') await collection.createFulltextIndex("description");
const indexes = await collection.indexes(); const indexes = await collection.indexes();
assert.equal(indexes.length, 1); assert.equal(indexes.length, 1);
// indexes contains information about the index // indexes contains information about the index
@ -268,7 +271,7 @@ Deletes the index with the given _indexHandle_ from the collection.
**Arguments** **Arguments**
* **indexHandle**: `string` - **indexHandle**: `string`
The handle of the index to delete. This can either be a fully-qualified The handle of the index to delete. This can either be a fully-qualified
identifier or the collection-specific key of the index. If the value is an identifier or the collection-specific key of the index. If the value is an
@ -278,14 +281,14 @@ Deletes the index with the given _indexHandle_ from the collection.
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createFulltextIndex('description'); const index = await collection.createFulltextIndex("description");
await collection.dropIndex(index.id); await collection.dropIndex(index.id);
// the index has been removed from the collection // the index has been removed from the collection
// -- or -- // -- or --
await collection.dropIndex(index.id.split('/')[1]); await collection.dropIndex(index.id.split("/")[1]);
// the index has been removed from the collection // the index has been removed from the collection
``` ```
@ -295,41 +298,43 @@ await collection.dropIndex(index.id.split('/')[1]);
Creates a cap constraint index on the collection. Creates a cap constraint index on the collection.
**Note**: This method is not available when using the driver with ArangoDB 3.0 {% hint 'warning' %}
and higher as cap constraints are no longer supported. This method is not available when targeting ArangoDB 3.0 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
**Arguments** **Arguments**
* **size**: `Object` - **size**: `Object`
An object with any of the following properties: An object with any of the following properties:
* **size**: `number` (optional) - **size**: `number` (optional)
The maximum number of documents in the collection. The maximum number of documents in the collection.
* **byteSize**: `number` (optional) - **byteSize**: `number` (optional)
The maximum size of active document data in the collection (in bytes). The maximum size of active document data in the collection (in bytes).
If _size_ is a number, it will be interpreted as _size.size_. If _size_ is a number, it will be interpreted as _size.size_.
For more information on the properties of the _size_ object see For more information on the properties of the _size_ object see the
[the HTTP API for creating cap constraints](https://docs.arangodb.com/2.8/HttpIndexes/Cap.html). [HTTP API for creating cap constraints](https://docs.arangodb.com/2.8/HttpIndexes/Cap.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const collection = db.collection('some-collection'); const collection = db.collection("some-collection");
const index = await collection.createCapConstraint(20) const index = await collection.createCapConstraint(20);
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.equal(index.size, 20); assert.equal(index.size, 20);
// -- or -- // -- or --
const index = await collection.createCapConstraint({size: 20}) const index = await collection.createCapConstraint({ size: 20 });
// the index has been created with the handle `index.id` // the index has been created with the handle `index.id`
assert.equal(index.size, 20); assert.equal(index.size, 20);
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Collection API # Collection API
These functions implement the These functions implement the
@ -13,8 +13,8 @@ their specific type. I.e. it represents a shared subset between instances of
## Getting information about the collection ## Getting information about the collection
See See the
[the HTTP API documentation](../../../..//HTTP/Collection/Getting.html) [HTTP API documentation](../../../..//HTTP/Collection/Getting.html)
for details. for details.
## collection.exists ## collection.exists
@ -117,8 +117,8 @@ Retrieves the collection checksum.
- **opts**: `Object` (optional) - **opts**: `Object` (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for getting collection information](../../../..//HTTP/Collection/Getting.html). [HTTP API for getting collection information](../../../..//HTTP/Collection/Getting.html).
**Examples** **Examples**

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Simple queries # Simple queries
These functions implement the These functions implement the
@ -13,10 +13,10 @@ Performs a query to fetch all documents in the collection. Returns a
**Arguments** **Arguments**
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for returning all documents](../../../..//HTTP/SimpleQuery/index.html#return-all-documents). [HTTP API for returning all documents](../../../..//HTTP/SimpleQuery/index.html#return-all-documents).
## collection.any ## collection.any
@ -31,15 +31,17 @@ Fetches a document from the collection at random.
Performs a query to fetch the first documents in the collection. Returns an Performs a query to fetch the first documents in the collection. Returns an
array of the matching documents. array of the matching documents.
**Note**: This method is not available when using the driver with ArangoDB 3.0 {% hint 'warning' %}
and higher as the corresponding API method has been removed. This method is not available when targeting ArangoDB 3.0 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
**Arguments** **Arguments**
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for returning the first document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#first-document-of-a-collection). [HTTP API for returning the first document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#first-document-of-a-collection).
If _opts_ is a number it is treated as _opts.count_. If _opts_ is a number it is treated as _opts.count_.
@ -50,15 +52,17 @@ and higher as the corresponding API method has been removed.
Performs a query to fetch the last documents in the collection. Returns an array Performs a query to fetch the last documents in the collection. Returns an array
of the matching documents. of the matching documents.
**Note**: This method is not available when using the driver with ArangoDB 3.0 {% hint 'warning' %}
and higher as the corresponding API method has been removed. This method is not available when targeting ArangoDB 3.0 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
**Arguments** **Arguments**
* **opts**: `Object` (optional) - **opts**: `Object` (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for returning the last document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#last-document-of-a-collection). [HTTP API for returning the last document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#last-document-of-a-collection).
If _opts_ is a number it is treated as _opts.count_. If _opts_ is a number it is treated as _opts.count_.
@ -71,14 +75,14 @@ _example_. Returns a [new _Cursor_ instance](../Cursor.md) for the query results
**Arguments** **Arguments**
* **example**: _Object_ - **example**: _Object_
An object representing an example for documents to be matched against. An object representing an example for documents to be matched against.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for fetching documents by example](../../../..//HTTP/SimpleQuery/index.html#find-documents-matching-an-example). [HTTP API for fetching documents by example](../../../..//HTTP/SimpleQuery/index.html#find-documents-matching-an-example).
## collection.firstExample ## collection.firstExample
@ -88,7 +92,7 @@ Fetches the first document in the collection matching the given _example_.
**Arguments** **Arguments**
* **example**: _Object_ - **example**: _Object_
An object representing an example for documents to be matched against. An object representing an example for documents to be matched against.
@ -100,14 +104,14 @@ Removes all documents in the collection matching the given _example_.
**Arguments** **Arguments**
* **example**: _Object_ - **example**: _Object_
An object representing an example for documents to be matched against. An object representing an example for documents to be matched against.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for removing documents by example](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-example). [HTTP API for removing documents by example](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-example).
## collection.replaceByExample ## collection.replaceByExample
@ -118,18 +122,18 @@ given _newValue_.
**Arguments** **Arguments**
* **example**: _Object_ - **example**: _Object_
An object representing an example for documents to be matched against. An object representing an example for documents to be matched against.
* **newValue**: _Object_ - **newValue**: _Object_
The new value to replace matching documents with. The new value to replace matching documents with.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for replacing documents by example](../../../..//HTTP/SimpleQuery/index.html#replace-documents-by-example). [HTTP API for replacing documents by example](../../../..//HTTP/SimpleQuery/index.html#replace-documents-by-example).
## collection.updateByExample ## collection.updateByExample
@ -140,18 +144,18 @@ with the given _newValue_.
**Arguments** **Arguments**
* **example**: _Object_ - **example**: _Object_
An object representing an example for documents to be matched against. An object representing an example for documents to be matched against.
* **newValue**: _Object_ - **newValue**: _Object_
The new value to update matching documents with. The new value to update matching documents with.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for updating documents by example](../../../..//HTTP/SimpleQuery/index.html#update-documents-by-example). [HTTP API for updating documents by example](../../../..//HTTP/SimpleQuery/index.html#update-documents-by-example).
## collection.lookupByKeys ## collection.lookupByKeys
@ -162,7 +166,7 @@ array of the matching documents.
**Arguments** **Arguments**
* **keys**: _Array_ - **keys**: _Array_
An array of document keys to look up. An array of document keys to look up.
@ -174,14 +178,14 @@ Deletes the documents with the given _keys_ from the collection.
**Arguments** **Arguments**
* **keys**: _Array_ - **keys**: _Array_
An array of document keys to delete. An array of document keys to delete.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for removing documents by keys](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-their-keys). [HTTP API for removing documents by keys](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-their-keys).
## collection.fulltext ## collection.fulltext
@ -191,15 +195,15 @@ Performs a fulltext query in the given _fieldName_ on the collection.
**Arguments** **Arguments**
* **fieldName**: _String_ - **fieldName**: _String_
Name of the field to search on documents in the collection. Name of the field to search on documents in the collection.
* **query**: _String_ - **query**: _String_
Fulltext query string to search for. Fulltext query string to search for.
* **opts**: _Object_ (optional) - **opts**: _Object_ (optional)
For information on the possible options see For information on the possible options see the
[the HTTP API for fulltext queries](../../../..//HTTP/Indexes/Fulltext.html). [HTTP API for fulltext queries](../../../..//HTTP/Indexes/Fulltext.html).

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Cursor API # Cursor API
_Cursor_ instances provide an abstraction over the HTTP API's limitations. _Cursor_ instances provide an abstraction over the HTTP API's limitations.
@ -178,7 +178,7 @@ Advances the cursor by applying the function _fn_ to each value in the cursor's
remaining result list until the cursor is exhausted or _fn_ returns a value that remaining result list until the cursor is exhausted or _fn_ returns a value that
evaluates to `true`. evaluates to `true`.
Returns `true` if _fn_ returned a value that evalutes to `true`, or `false` Returns `true` if _fn_ returned a value that evaluates to `true`, or `false`
otherwise. otherwise.
Equivalent to _Array.prototype.some_ (except async). Equivalent to _Array.prototype.some_ (except async).

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Managing AQL user functions # Managing AQL user functions
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Accessing collections # Accessing collections
These functions implement the These functions implement the

View File

@ -1,132 +1,9 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating databases # Manipulating databases
These functions implement the These functions implement the
[HTTP API for manipulating databases](../../../..//HTTP/Database/index.html). [HTTP API for manipulating databases](../../../..//HTTP/Database/index.html).
## database.acquireHostList
`async database.acquireHostList(): this`
Updates the URL list by requesting a list of all coordinators in the cluster and adding any endpoints not initially specified in the _url_ configuration.
For long-running processes communicating with an ArangoDB cluster it is recommended to run this method repeatedly (e.g. once per hour) to make sure new coordinators are picked up correctly and can be used for fail-over or load balancing.
**Note**: This method can not be used when the arangojs instance was created with `isAbsolute: true`.
## database.useDatabase
`database.useDatabase(databaseName): this`
Updates the _Database_ instance and its connection string to use the given
_databaseName_, then returns itself.
**Note**: This method can not be used when the arangojs instance was created with `isAbsolute: true`.
**Arguments**
- **databaseName**: `string`
The name of the database to use.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
// The database instance now uses the database "test".
```
## database.useBasicAuth
`database.useBasicAuth([username, [password]]): this`
Updates the _Database_ instance's `authorization` header to use Basic
authentication with the given _username_ and _password_, then returns itself.
**Arguments**
- **username**: `string` (Default: `"root"`)
The username to authenticate with.
- **password**: `string` (Default: `""`)
The password to authenticate with.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
db.useBasicAuth("admin", "hunter2");
// The database instance now uses the database "test"
// with the username "admin" and password "hunter2".
```
## database.useBearerAuth
`database.useBearerAuth(token): this`
Updates the _Database_ instance's `authorization` header to use Bearer
authentication with the given authentication token, then returns itself.
**Arguments**
- **token**: `string`
The token to authenticate with.
**Examples**
```js
const db = new Database();
db.useBearerAuth("keyboardcat");
// The database instance now uses Bearer authentication.
```
## database.login
`async database.login([username, [password]]): string`
Validates the given database credentials and exchanges them for an
authentication token, then uses the authentication token for future
requests and returns it.
**Arguments**
- **username**: `string` (Default: `"root"`)
The username to authenticate with.
- **password**: `string` (Default: `""`)
The password to authenticate with.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
await db.login("admin", "hunter2");
// The database instance now uses the database "test"
// with an authentication token for the "admin" user.
```
## database.version
`async database.version(): Object`
Fetches the ArangoDB version information for the active database from the server.
**Examples**
```js
const db = new Database();
const version = await db.version();
// the version object contains the ArangoDB version information.
```
## database.createDatabase ## database.createDatabase
`async database.createDatabase(databaseName, [users]): Object` `async database.createDatabase(databaseName, [users]): Object`
@ -163,7 +40,7 @@ Creates a new database with the given _databaseName_.
```js ```js
const db = new Database(); const db = new Database();
const info = await db.createDatabase('mydb', [{username: 'root'}]); const info = await db.createDatabase("mydb", [{ username: "root" }]);
// the database has been created // the database has been created
``` ```
@ -232,7 +109,7 @@ Deletes the database with the given _databaseName_ from the server.
```js ```js
const db = new Database(); const db = new Database();
await db.dropDatabase('mydb'); await db.dropDatabase("mydb");
// database "mydb" no longer exists // database "mydb" no longer exists
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Managing Foxx services # Managing Foxx services
## database.listServices ## database.listServices
@ -9,7 +9,7 @@ Fetches a list of all installed service.
**Arguments** **Arguments**
* **excludeSystem**: `boolean` (Default: `true`) - **excludeSystem**: `boolean` (Default: `true`)
Whether system services should be excluded. Whether system services should be excluded.
@ -31,56 +31,56 @@ Installs a new service.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **source**: `Buffer | Readable | File | string` - **source**: `Buffer | Readable | File | string`
The service bundle to install. The service bundle to install.
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **configuration**: `Object` (optional) - **configuration**: `Object` (optional)
An object mapping configuration option names to values. An object mapping configuration option names to values.
* **dependencies**: `Object` (optional) - **dependencies**: `Object` (optional)
An object mapping dependency aliases to mount points. An object mapping dependency aliases to mount points.
* **development**: `boolean` (Default: `false`) - **development**: `boolean` (Default: `false`)
Whether the service should be installed in development mode. Whether the service should be installed in development mode.
* **legacy**: `boolean` (Default: `false`) - **legacy**: `boolean` (Default: `false`)
Whether the service should be installed in legacy compatibility mode. Whether the service should be installed in legacy compatibility mode.
This overrides the `engines` option in the service manifest (if any). This overrides the `engines` option in the service manifest (if any).
* **setup**: `boolean` (Default: `true`) - **setup**: `boolean` (Default: `true`)
Whether the setup script should be executed. Whether the setup script should be executed.
**Examples** **Examples**
```js ```js
const source = fs.createReadStream('./my-foxx-service.zip'); const source = fs.createReadStream("./my-foxx-service.zip");
const info = await db.installService('/hello', source); const info = await db.installService("/hello", source);
// -- or -- // -- or --
const source = fs.readFileSync('./my-foxx-service.zip'); const source = fs.readFileSync("./my-foxx-service.zip");
const info = await db.installService('/hello', source); const info = await db.installService("/hello", source);
// -- or -- // -- or --
const element = document.getElementById('my-file-input'); const element = document.getElementById("my-file-input");
const source = element.files[0]; const source = element.files[0];
const info = await db.installService('/hello', source); const info = await db.installService("/hello", source);
``` ```
## database.replaceService ## database.replaceService
@ -92,64 +92,64 @@ service and installing a new service at the same mount point.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **source**: `Buffer | Readable | File | string` - **source**: `Buffer | Readable | File | string`
The service bundle to replace the existing service with. The service bundle to replace the existing service with.
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **configuration**: `Object` (optional) - **configuration**: `Object` (optional)
An object mapping configuration option names to values. An object mapping configuration option names to values.
This configuration will replace the existing configuration. This configuration will replace the existing configuration.
* **dependencies**: `Object` (optional) - **dependencies**: `Object` (optional)
An object mapping dependency aliases to mount points. An object mapping dependency aliases to mount points.
These dependencies will replace the existing dependencies. These dependencies will replace the existing dependencies.
* **development**: `boolean` (Default: `false`) - **development**: `boolean` (Default: `false`)
Whether the new service should be installed in development mode. Whether the new service should be installed in development mode.
* **legacy**: `boolean` (Default: `false`) - **legacy**: `boolean` (Default: `false`)
Whether the new service should be installed in legacy compatibility mode. Whether the new service should be installed in legacy compatibility mode.
This overrides the `engines` option in the service manifest (if any). This overrides the `engines` option in the service manifest (if any).
* **teardown**: `boolean` (Default: `true`) - **teardown**: `boolean` (Default: `true`)
Whether the teardown script of the old service should be executed. Whether the teardown script of the old service should be executed.
* **setup**: `boolean` (Default: `true`) - **setup**: `boolean` (Default: `true`)
Whether the setup script of the new service should be executed. Whether the setup script of the new service should be executed.
**Examples** **Examples**
```js ```js
const source = fs.createReadStream('./my-foxx-service.zip'); const source = fs.createReadStream("./my-foxx-service.zip");
const info = await db.replaceService('/hello', source); const info = await db.replaceService("/hello", source);
// -- or -- // -- or --
const source = fs.readFileSync('./my-foxx-service.zip'); const source = fs.readFileSync("./my-foxx-service.zip");
const info = await db.replaceService('/hello', source); const info = await db.replaceService("/hello", source);
// -- or -- // -- or --
const element = document.getElementById('my-file-input'); const element = document.getElementById("my-file-input");
const source = element.files[0]; const source = element.files[0];
const info = await db.replaceService('/hello', source); const info = await db.replaceService("/hello", source);
``` ```
## database.upgradeService ## database.upgradeService
@ -161,64 +161,64 @@ service's configuration and dependencies.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **source**: `Buffer | Readable | File | string` - **source**: `Buffer | Readable | File | string`
The service bundle to replace the existing service with. The service bundle to replace the existing service with.
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **configuration**: `Object` (optional) - **configuration**: `Object` (optional)
An object mapping configuration option names to values. An object mapping configuration option names to values.
This configuration will be merged into the existing configuration. This configuration will be merged into the existing configuration.
* **dependencies**: `Object` (optional) - **dependencies**: `Object` (optional)
An object mapping dependency aliases to mount points. An object mapping dependency aliases to mount points.
These dependencies will be merged into the existing dependencies. These dependencies will be merged into the existing dependencies.
* **development**: `boolean` (Default: `false`) - **development**: `boolean` (Default: `false`)
Whether the new service should be installed in development mode. Whether the new service should be installed in development mode.
* **legacy**: `boolean` (Default: `false`) - **legacy**: `boolean` (Default: `false`)
Whether the new service should be installed in legacy compatibility mode. Whether the new service should be installed in legacy compatibility mode.
This overrides the `engines` option in the service manifest (if any). This overrides the `engines` option in the service manifest (if any).
* **teardown**: `boolean` (Default: `false`) - **teardown**: `boolean` (Default: `false`)
Whether the teardown script of the old service should be executed. Whether the teardown script of the old service should be executed.
* **setup**: `boolean` (Default: `true`) - **setup**: `boolean` (Default: `true`)
Whether the setup script of the new service should be executed. Whether the setup script of the new service should be executed.
**Examples** **Examples**
```js ```js
const source = fs.createReadStream('./my-foxx-service.zip'); const source = fs.createReadStream("./my-foxx-service.zip");
const info = await db.upgradeService('/hello', source); const info = await db.upgradeService("/hello", source);
// -- or -- // -- or --
const source = fs.readFileSync('./my-foxx-service.zip'); const source = fs.readFileSync("./my-foxx-service.zip");
const info = await db.upgradeService('/hello', source); const info = await db.upgradeService("/hello", source);
// -- or -- // -- or --
const element = document.getElementById('my-file-input'); const element = document.getElementById("my-file-input");
const source = element.files[0]; const source = element.files[0];
const info = await db.upgradeService('/hello', source); const info = await db.upgradeService("/hello", source);
``` ```
## database.uninstallService ## database.uninstallService
@ -229,22 +229,22 @@ Completely removes a service from the database.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **teardown**: `boolean` (Default: `true`) - **teardown**: `boolean` (Default: `true`)
Whether the teardown script should be executed. Whether the teardown script should be executed.
**Examples** **Examples**
```js ```js
await db.uninstallService('/my-service'); await db.uninstallService("/my-service");
// service was uninstalled // service was uninstalled
``` ```
@ -256,14 +256,14 @@ Retrieves information about a mounted service.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const info = await db.getService('/my-service'); const info = await db.getService("/my-service");
// info contains detailed information about the service // info contains detailed information about the service
``` ```
@ -276,39 +276,38 @@ and their current values.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values. Only return the current values.
**Examples** **Examples**
```js ```js
const config = await db.getServiceConfiguration('/my-service'); const config = await db.getServiceConfiguration("/my-service");
// config contains information about the service's configuration // config contains information about the service's configuration
``` ```
## database.replaceServiceConfiguration ## database.replaceServiceConfiguration
`async database.replaceServiceConfiguration(mount, configuration, [minimal]): `async database.replaceServiceConfiguration(mount, configuration, [minimal]): Object`
Object`
Replaces the configuration of the given service. Replaces the configuration of the given service.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **configuration**: `Object` - **configuration**: `Object`
An object mapping configuration option names to values. An object mapping configuration option names to values.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values and warnings (if any). Only return the current values and warnings (if any).
@ -318,31 +317,30 @@ Replaces the configuration of the given service.
**Examples** **Examples**
```js ```js
const config = {currency: 'USD', locale: 'en-US'}; const config = { currency: "USD", locale: "en-US" };
const info = await db.replaceServiceConfiguration('/my-service', config); const info = await db.replaceServiceConfiguration("/my-service", config);
// info.values contains information about the service's configuration // info.values contains information about the service's configuration
// info.warnings contains any validation errors for the configuration // info.warnings contains any validation errors for the configuration
``` ```
## database.updateServiceConfiguration ## database.updateServiceConfiguration
`async database.updateServiceConfiguration(mount, configuration, [minimal]): `async database.updateServiceConfiguration(mount, configuration, [minimal]): Object`
Object`
Updates the configuration of the given service my merging the new values into Updates the configuration of the given service my merging the new values into
the existing ones. the existing ones.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **configuration**: `Object` - **configuration**: `Object`
An object mapping configuration option names to values. An object mapping configuration option names to values.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values and warnings (if any). Only return the current values and warnings (if any).
@ -352,8 +350,8 @@ the existing ones.
**Examples** **Examples**
```js ```js
const config = {locale: 'en-US'}; const config = { locale: "en-US" };
const info = await db.updateServiceConfiguration('/my-service', config); const info = await db.updateServiceConfiguration("/my-service", config);
// info.values contains information about the service's configuration // info.values contains information about the service's configuration
// info.warnings contains any validation errors for the configuration // info.warnings contains any validation errors for the configuration
``` ```
@ -367,39 +365,38 @@ current mount points.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values and warnings (if any). Only return the current values and warnings (if any).
**Examples** **Examples**
```js ```js
const deps = await db.getServiceDependencies('/my-service'); const deps = await db.getServiceDependencies("/my-service");
// deps contains information about the service's dependencies // deps contains information about the service's dependencies
``` ```
## database.replaceServiceDependencies ## database.replaceServiceDependencies
`async database.replaceServiceDependencies(mount, dependencies, [minimal]): `async database.replaceServiceDependencies(mount, dependencies, [minimal]): Object`
Object`
Replaces the dependencies for the given service. Replaces the dependencies for the given service.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **dependencies**: `Object` - **dependencies**: `Object`
An object mapping dependency aliases to mount points. An object mapping dependency aliases to mount points.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values and warnings (if any). Only return the current values and warnings (if any).
@ -409,31 +406,30 @@ Replaces the dependencies for the given service.
**Examples** **Examples**
```js ```js
const deps = {mailer: '/mailer-api', auth: '/remote-auth'}; const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
const info = await db.replaceServiceDependencies('/my-service', deps); const info = await db.replaceServiceDependencies("/my-service", deps);
// info.values contains information about the service's dependencies // info.values contains information about the service's dependencies
// info.warnings contains any validation errors for the dependencies // info.warnings contains any validation errors for the dependencies
``` ```
## database.updateServiceDependencies ## database.updateServiceDependencies
`async database.updateServiceDependencies(mount, dependencies, [minimal]): `async database.updateServiceDependencies(mount, dependencies, [minimal]): Object`
Object`
Updates the dependencies for the given service by merging the new values into Updates the dependencies for the given service by merging the new values into
the existing ones. the existing ones.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **dependencies**: `Object` - **dependencies**: `Object`
An object mapping dependency aliases to mount points. An object mapping dependency aliases to mount points.
* **minimal**: `boolean` (Default: `false`) - **minimal**: `boolean` (Default: `false`)
Only return the current values and warnings (if any). Only return the current values and warnings (if any).
@ -443,8 +439,8 @@ the existing ones.
**Examples** **Examples**
```js ```js
const deps = {mailer: '/mailer-api'}; const deps = { mailer: "/mailer-api" };
const info = await db.updateServiceDependencies('/my-service', deps); const info = await db.updateServiceDependencies("/my-service", deps);
// info.values contains information about the service's dependencies // info.values contains information about the service's dependencies
// info.warnings contains any validation errors for the dependencies // info.warnings contains any validation errors for the dependencies
``` ```
@ -457,14 +453,14 @@ Enables development mode for the given service.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const info = await db.enableServiceDevelopmentMode('/my-service'); const info = await db.enableServiceDevelopmentMode("/my-service");
// the service is now in development mode // the service is now in development mode
// info contains detailed information about the service // info contains detailed information about the service
``` ```
@ -478,14 +474,14 @@ the database.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const info = await db.disableServiceDevelopmentMode('/my-service'); const info = await db.disableServiceDevelopmentMode("/my-service");
// the service is now in production mode // the service is now in production mode
// info contains detailed information about the service // info contains detailed information about the service
``` ```
@ -500,14 +496,14 @@ Returns an object mapping each name to a more readable representation.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const scripts = await db.listServiceScripts('/my-service'); const scripts = await db.listServiceScripts("/my-service");
// scripts is an object listing the service scripts // scripts is an object listing the service scripts
``` ```
@ -519,22 +515,22 @@ Runs a service script and returns the result.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
* **name**: `string` - **name**: `string`
Name of the script to execute. Name of the script to execute.
* **scriptArg**: `any` - **scriptArg**: `any`
Value that will be passed as an argument to the script. Value that will be passed as an argument to the script.
**Examples** **Examples**
```js ```js
const result = await db.runServiceScript('/my-service', 'setup'); const result = await db.runServiceScript("/my-service", "setup");
// result contains the script's exports (if any) // result contains the script's exports (if any)
``` ```
@ -546,40 +542,40 @@ Runs the tests of a given service and returns a formatted report.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database The service's mount point, relative to the database
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **reporter**: `string` (Default: `default`) - **reporter**: `string` (Default: `default`)
The reporter to use to process the test results. The reporter to use to process the test results.
As of ArangoDB 3.2 the following reporters are supported: As of ArangoDB 3.2 the following reporters are supported:
* **stream**: an array of event objects - **stream**: an array of event objects
* **suite**: nested suite objects with test results - **suite**: nested suite objects with test results
* **xunit**: JSONML representation of an XUnit report - **xunit**: JSONML representation of an XUnit report
* **tap**: an array of TAP event strings - **tap**: an array of TAP event strings
* **default**: an array of test results - **default**: an array of test results
* **idiomatic**: `boolean` (Default: `false`) - **idiomatic**: `boolean` (Default: `false`)
Whether the results should be converted to the apropriate `string` Whether the results should be converted to the apropriate `string`
representation: representation:
* **xunit** reports will be formatted as XML documents - **xunit** reports will be formatted as XML documents
* **tap** reports will be formatted as TAP streams - **tap** reports will be formatted as TAP streams
* **stream** reports will be formatted as JSON-LD streams - **stream** reports will be formatted as JSON-LD streams
**Examples** **Examples**
```js ```js
const opts = {reporter: 'xunit', idiomatic: true}; const opts = { reporter: "xunit", idiomatic: true };
const result = await db.runServiceTests('/my-service', opts); const result = await db.runServiceTests("/my-service", opts);
// result contains the XUnit report as a string // result contains the XUnit report as a string
``` ```
@ -593,14 +589,14 @@ Returns a `Buffer` in Node or `Blob` in the browser version.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const bundle = await db.downloadService('/my-service'); const bundle = await db.downloadService("/my-service");
// bundle is a Buffer/Blob of the service bundle // bundle is a Buffer/Blob of the service bundle
``` ```
@ -614,14 +610,14 @@ Returns `undefined` if no such file could be found.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const readme = await db.getServiceReadme('/my-service'); const readme = await db.getServiceReadme("/my-service");
// readme is a string containing the service README's // readme is a string containing the service README's
// text content, or undefined if no README exists // text content, or undefined if no README exists
``` ```
@ -635,14 +631,14 @@ given mount point.
**Arguments** **Arguments**
* **mount**: `string` - **mount**: `string`
The service's mount point, relative to the database. The service's mount point, relative to the database.
**Examples** **Examples**
```js ```js
const spec = await db.getServiceDocumentation('/my-service'); const spec = await db.getServiceDocumentation("/my-service");
// spec is a Swagger API description of the service // spec is a Swagger API description of the service
``` ```
@ -655,7 +651,7 @@ bundles missing in the database.
**Arguments** **Arguments**
* **replace**: `boolean` (Default: `false`) - **replace**: `boolean` (Default: `false`)
Also commit outdated services. Also commit outdated services.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Accessing graphs # Accessing graphs
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Arbitrary HTTP routes # Arbitrary HTTP routes
## database.route ## database.route

View File

@ -1,10 +1,10 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Queries # Queries
This function implements the This function implements the
[HTTP API for single roundtrip AQL queries](../../../..//HTTP/AqlQueryCursor/QueryResults.html). [HTTP API for single round-trip AQL queries](../../../..//HTTP/AqlQueryCursor/QueryResults.html).
For collection-specific queries see [simple queries](../Collection/SimpleQueries.md). For collection-specific queries see [Simple Queries](../Collection/SimpleQueries.md).
## database.query ## database.query
@ -31,8 +31,11 @@ Performs a database query using the given _query_ and _bindVars_, then returns a
If _opts.count_ is set to `true`, the cursor will have a _count_ property set to If _opts.count_ is set to `true`, the cursor will have a _count_ property set to
the query result count. the query result count.
Possible key options in _opts.options_ include: _failOnWarning_, _cache_, profile or _skipInaccessibleCollections_.
For a complete list of query settings please reference the [arangodb.com documentation](../../../..//AQL/Invocation/WithArangosh.html#setting-options). Possible key options in _opts.options_ include: _failOnWarning_, _cache_,
profile or _skipInaccessibleCollections_.
For a complete list of query settings please reference the
[setting options](../../../..//AQL/Invocation/WithArangosh.html#setting-options).
If _query_ is an object with _query_ and _bindVars_ properties, those will be If _query_ is an object with _query_ and _bindVars_ properties, those will be
used as the values of the respective arguments instead. used as the values of the respective arguments instead.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Database API # Database API
## new Database ## new Database
@ -20,12 +20,15 @@ If _config_ is a string, it will be interpreted as _config.url_.
Base URL of the ArangoDB server or list of server URLs. Base URL of the ArangoDB server or list of server URLs.
When working with a cluster or a single server with leader/follower failover, When working with a cluster or a single server with leader/follower failover,
[the method `db.acquireHostList`](DatabaseManipulation.md#databaseacquirehostlist) [the method `db.acquireHostList`](#databaseacquirehostlist)
can be used to automatically pick up additional coordinators/followers at can be used to automatically pick up additional coordinators/followers at
any point. any point.
**Note**: As of arangojs 6.0.0 it is no longer possible to pass {% hint 'warning' %}
the username or password from the URL. As of arangojs 6.0.0 it is no longer possible to pass
the username or password from the URL. Use
[`database.useBasicAuth`](#databaseusebasicauth) instead.
{% endhint %}
If you want to use ArangoDB with authentication, see If you want to use ArangoDB with authentication, see
_useBasicAuth_ or _useBearerAuth_ methods. _useBasicAuth_ or _useBearerAuth_ methods.
@ -51,17 +54,13 @@ If _config_ is a string, it will be interpreted as _config.url_.
- **arangoVersion**: `number` (Default: `30000`) - **arangoVersion**: `number` (Default: `30000`)
Value of the `x-arango-version` header. This should match the lowest Numeric representation of the ArangoDB version the driver should expect.
version of ArangoDB you expect to be using. The format is defined as The format is defined as `XYYZZ` where `X` is the major version, `Y` is
`XYYZZ` where `X` is the major version, `Y` is the two-digit minor version the zero-filled two-digit minor version and `Z` is the zero-filled two-digit
and `Z` is the two-digit bugfix version. bugfix version, e.g. `30102` for 3.1.2, `20811` for 2.8.11.
**Example**: `30102` corresponds to version 3.1.2 of ArangoDB. Depending on this value certain methods may become unavailable or change
their behavior to remain compatible with different versions of ArangoDB.
**Note**: The driver will behave differently when using different major
versions of ArangoDB to compensate for API changes. Some functions are
not available on every major version of ArangoDB as indicated in their
descriptions below (e.g. _collection.first_, _collection.bulkUpdate_).
- **headers**: `Object` (optional) - **headers**: `Object` (optional)
@ -134,6 +133,135 @@ If _config_ is a string, it will be interpreted as _config.url_.
**Note**: Requests bound to a specific server (e.g. fetching query results) **Note**: Requests bound to a specific server (e.g. fetching query results)
will never be retried automatically and ignore this setting. will never be retried automatically and ignore this setting.
## database.acquireHostList
`async database.acquireHostList(): this`
Updates the URL list by requesting a list of all coordinators in the cluster
and adding any endpoints not initially specified in the _url_ configuration.
For long-running processes communicating with an ArangoDB cluster it is
recommended to run this method repeatedly (e.g. once per hour) to make sure
new coordinators are picked up correctly and can be used for fail-over or
load balancing.
**Note**: This method can not be used when the arangojs instance was created
with `isAbsolute: true`.
## database.useDatabase
`database.useDatabase(databaseName): this`
Updates the _Database_ instance and its connection string to use the given
_databaseName_, then returns itself.
**Note**: This method can not be used when the arangojs instance was created
with `isAbsolute: true`.
**Arguments**
- **databaseName**: `string`
The name of the database to use.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
// The database instance now uses the database "test".
```
## database.useBasicAuth
`database.useBasicAuth([username, [password]]): this`
Updates the _Database_ instance's `authorization` header to use Basic
authentication with the given _username_ and _password_, then returns itself.
**Arguments**
- **username**: `string` (Default: `"root"`)
The username to authenticate with.
- **password**: `string` (Default: `""`)
The password to authenticate with.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
db.useBasicAuth("admin", "hunter2");
// The database instance now uses the database "test"
// with the username "admin" and password "hunter2".
```
## database.useBearerAuth
`database.useBearerAuth(token): this`
Updates the _Database_ instance's `authorization` header to use Bearer
authentication with the given authentication token, then returns itself.
**Arguments**
- **token**: `string`
The token to authenticate with.
**Examples**
```js
const db = new Database();
db.useBearerAuth("keyboardcat");
// The database instance now uses Bearer authentication.
```
## database.login
`async database.login([username, [password]]): string`
Validates the given database credentials and exchanges them for an
authentication token, then uses the authentication token for future
requests and returns it.
**Arguments**
- **username**: `string` (Default: `"root"`)
The username to authenticate with.
- **password**: `string` (Default: `""`)
The password to authenticate with.
**Examples**
```js
const db = new Database();
db.useDatabase("test");
await db.login("admin", "hunter2");
// The database instance now uses the database "test"
// with an authentication token for the "admin" user.
```
## database.version
`async database.version(): Object`
Fetches the ArangoDB version information for the active database from the server.
**Examples**
```js
const db = new Database();
const version = await db.version();
// the version object contains the ArangoDB version information.
```
## database.close ## database.close
`database.close(): void` `database.close(): void`

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Transactions # Transactions
This function implements the This function implements the
@ -6,62 +6,65 @@ This function implements the
## database.transaction ## database.transaction
`async database.transaction(collections, action, [params, [options]]): `async database.transaction(collections, action, [params, [options]]): Object`
Object`
Performs a server-side transaction and returns its return value. Performs a server-side transaction and returns its return value.
**Arguments** **Arguments**
* **collections**: `Object` - **collections**: `Object`
An object with the following properties: An object with the following properties:
* **read**: `Array<string>` (optional) - **read**: `Array<string>` (optional)
An array of names (or a single name) of collections that will be read from An array of names (or a single name) of collections that will be read from
during the transaction. during the transaction.
* **write**: `Array<string>` (optional) - **write**: `Array<string>` (optional)
An array of names (or a single name) of collections that will be written to An array of names (or a single name) of collections that will be written to
or read from during the transaction. or read from during the transaction.
* **action**: `string` - **action**: `string`
A string evaluating to a JavaScript function to be executed on the server. A string evaluating to a JavaScript function to be executed on the server.
**Note**: For accessing the database from within ArangoDB, see {% hint 'warning ' %}
[the documentation for the `@arangodb` module in ArangoDB](../../../..//Manual/Appendix/JavaScriptModules/ArangoDB.html). This function will be executed on the server inside ArangoDB and can not use
the arangojs driver or any variables other than those passed as _params_.
For accessing the database from within ArangoDB, see the documentation for the
[`@arangodb` module in ArangoDB](../../../..//Manual/Appendix/JavaScriptModules/ArangoDB.html).
{% endhint %}
* **params**: `Object` (optional) - **params**: `Object` (optional)
Available as variable `params` when the _action_ function is being executed on Available as variable `params` when the _action_ function is being executed on
server. Check the example below. server. Check the example below.
* **options**: `Object` (optional) - **options**: `Object` (optional)
An object with any of the following properties: An object with any of the following properties:
* **lockTimeout**: `number` (optional) - **lockTimeout**: `number` (optional)
Determines how long the database will wait while attempting to gain locks on Determines how long the database will wait while attempting to gain locks on
collections used by the transaction before timing out. collections used by the transaction before timing out.
* **waitForSync**: `boolean` (optional) - **waitForSync**: `boolean` (optional)
Determines whether to force the transaction to write all data to disk before returning. Determines whether to force the transaction to write all data to disk before returning.
* **maxTransactionSize**: `number` (optional) - **maxTransactionSize**: `number` (optional)
Determines the transaction size limit in bytes. Honored by the RocksDB storage engine only. Determines the transaction size limit in bytes. Honored by the RocksDB storage engine only.
* **intermediateCommitCount**: `number` (optional) - **intermediateCommitCount**: `number` (optional)
Determines the maximum number of operations after which an intermediate commit is Determines the maximum number of operations after which an intermediate commit is
performed automatically. Honored by the RocksDB storage engine only. performed automatically. Honored by the RocksDB storage engine only.
* **intermediateCommitSize**: `number` (optional) - **intermediateCommitSize**: `number` (optional)
Determine the maximum total size of operations after which an intermediate commit is Determine the maximum total size of operations after which an intermediate commit is
performed automatically. Honored by the RocksDB storage engine only. performed automatically. Honored by the RocksDB storage engine only.
@ -74,27 +77,27 @@ JavaScript function, it's not possible to pass in a JavaScript function directly
because the function needs to be evaluated on the server and will be transmitted because the function needs to be evaluated on the server and will be transmitted
in plain text. in plain text.
For more information on transactions, see For more information on transactions, see the
[the HTTP API documentation for transactions](../../../..//HTTP/Transaction/index.html). [HTTP API documentation for transactions](../../../..//HTTP/Transaction/index.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const action = String(function (params) { const action = String(function(params) {
// This code will be executed inside ArangoDB! // This code will be executed inside ArangoDB!
const db = require('@arangodb').db; const db = require("@arangodb").db;
return db._query(aql` return db
._query(
aql`
FOR user IN _users FOR user IN _users
FILTER user.age > ${params.age} FILTER user.age > ${params.age}
RETURN u.user RETURN u.user
`).toArray(); `
)
.toArray();
}); });
const result = await db.transaction( const result = await db.transaction({ read: "_users" }, action, { age: 12 });
{read: '_users'},
action,
{age: 12}
);
// result contains the return value of the action // result contains the return value of the action
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Accessing views # Accessing views
These functions implement the These functions implement the
@ -8,13 +8,18 @@ These functions implement the
`database.arangoSearchView(viewName): ArangoSearchView` `database.arangoSearchView(viewName): ArangoSearchView`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
Returns a _ArangoSearchView_ instance for the given view name. Returns a _ArangoSearchView_ instance for the given view name.
**Arguments** **Arguments**
- **viewName**: `string` - **viewName**: `string`
Name of the `arangosearch` view. Name of the arangosearch view.
**Examples** **Examples**
@ -27,6 +32,11 @@ const view = db.arangoSearchView("potatoes");
`async database.listViews(): Array<Object>` `async database.listViews(): Array<Object>`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
Fetches all views from the database and returns an array of view Fetches all views from the database and returns an array of view
descriptions. descriptions.
@ -43,6 +53,11 @@ const views = await db.listViews();
`async database.views([excludeSystem]): Array<View>` `async database.views([excludeSystem]): Array<View>`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../../GettingStarted/README.md#compatibility).
{% endhint %}
Fetches all views from the database and returns an array of Fetches all views from the database and returns an array of
_ArangoSearchView_ instances for the views. _ArangoSearchView_ instances for the views.
@ -51,6 +66,6 @@ _ArangoSearchView_ instances for the views.
```js ```js
const db = new Database(); const db = new Database();
const views = await db.views() const views = await db.views();
// views is an array of ArangoSearchView instances // views is an array of ArangoSearchView instances
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# GraphEdgeCollection API # GraphEdgeCollection API
The _GraphEdgeCollection API_ extends the The _GraphEdgeCollection API_ extends the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating edges # Manipulating edges
## graph.edgeCollection ## graph.edgeCollection

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Graph API # Graph API
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# GraphVertexCollection API # GraphVertexCollection API
The _GraphVertexCollection API_ extends the The _GraphVertexCollection API_ extends the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Manipulating vertices # Manipulating vertices
## graph.vertexCollection ## graph.vertexCollection

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# ArangoDB JavaScript Driver - Reference # ArangoDB JavaScript Driver - Reference
- [Database](Database/README.md) - [Database](Database/README.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# Route API # Route API
_Route_ instances provide access for arbitrary HTTP requests. This allows easy _Route_ instances provide access for arbitrary HTTP requests. This allows easy

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
# View API # View API
These functions implement the These functions implement the
@ -8,13 +8,18 @@ These functions implement the
`async view.exists(): boolean` `async view.exists(): boolean`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Checks whether the view exists. Checks whether the view exists.
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const result = await view.exists(); const result = await view.exists();
// result indicates whether the view exists // result indicates whether the view exists
``` ```
@ -23,13 +28,18 @@ const result = await view.exists();
`async view.get(): Object` `async view.get(): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Retrieves general information about the view. Retrieves general information about the view.
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const data = await view.get(); const data = await view.get();
// data contains general information about the view // data contains general information about the view
``` ```
@ -38,13 +48,18 @@ const data = await view.get();
`async view.properties(): Object` `async view.properties(): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Retrieves the view's properties. Retrieves the view's properties.
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const data = await view.properties(); const data = await view.properties();
// data contains the view's properties // data contains the view's properties
``` ```
@ -53,6 +68,11 @@ const data = await view.properties();
`async view.create([properties]): Object` `async view.create([properties]): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Creates a view with the given _properties_ for this view's name, Creates a view with the given _properties_ for this view's name,
then returns the server response. then returns the server response.
@ -60,15 +80,15 @@ then returns the server response.
- **properties**: `Object` (optional) - **properties**: `Object` (optional)
For more information on the _properties_ object, see For more information on the _properties_ object, see the
[the HTTP API documentation for creating views](../../..//HTTP/Views/ArangoSearch.html). [HTTP API documentation for creating views](../../..//HTTP/Views/ArangoSearch.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('potatoes'); const view = db.arangoSearchView("potatoes");
await view.create() await view.create();
// the arangosearch view "potatoes" now exists // the arangosearch view "potatoes" now exists
``` ```
@ -76,50 +96,65 @@ await view.create()
`async view.setProperties(properties): Object` `async view.setProperties(properties): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Updates the properties of the view. Updates the properties of the view.
**Arguments** **Arguments**
- **properties**: `Object` - **properties**: `Object`
For information on the _properties_ argument see For information on the _properties_ argument see the
[the HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html). [HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const result = await view.setProperties({ locale: "C" }) const result = await view.setProperties({ consolidationIntervalMsec: 123 });
assert.equal(result.locale, "C"); assert.equal(result.consolidationIntervalMsec, 123);
``` ```
## view.replaceProperties ## view.replaceProperties
`async view.replaceProperties(properties): Object` `async view.replaceProperties(properties): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Replaces the properties of the view. Replaces the properties of the view.
**Arguments** **Arguments**
- **properties**: `Object` - **properties**: `Object`
For information on the _properties_ argument see For information on the _properties_ argument see the
[the HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html). [HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const result = await view.replaceProperties({ locale: "C" }) const result = await view.replaceProperties({ consolidationIntervalMsec: 234 });
assert.equal(result.locale, "C"); assert.equal(result.consolidationIntervalMsec, 234);
``` ```
## view.rename ## view.rename
`async view.rename(name): Object` `async view.rename(name): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Renames the view. The _View_ instance will automatically update its Renames the view. The _View_ instance will automatically update its
name when the rename succeeds. name when the rename succeeds.
@ -127,9 +162,9 @@ name when the rename succeeds.
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
const result = await view.rename('new-view-name') const result = await view.rename("new-view-name");
assert.equal(result.name, 'new-view-name'); assert.equal(result.name, "new-view-name");
assert.equal(view.name, result.name); assert.equal(view.name, result.name);
// result contains additional information about the view // result contains additional information about the view
``` ```
@ -138,13 +173,18 @@ assert.equal(view.name, result.name);
`async view.drop(): Object` `async view.drop(): Object`
{% hint 'info' %}
This method is only available when targeting ArangoDB 3.4 or later,
see [Compatibility](../GettingStarted/README.md#compatibility).
{% endhint %}
Deletes the view from the database. Deletes the view from the database.
**Examples** **Examples**
```js ```js
const db = new Database(); const db = new Database();
const view = db.arangoSearchView('some-view'); const view = db.arangoSearchView("some-view");
await view.drop(); await view.drop();
// the view "some-view" no longer exists // the view "some-view" no longer exists
``` ```

View File

@ -1,10 +1,11 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# ArangoDB Java Driver - Getting Started # ArangoDB Java Driver - Getting Started
## Supported versions ## Supported versions
<table> <table>
<tr><th>arangodb-java-driver</th><th>ArangoDB</th><th>network protocol</th><th>Java version</th></tr> <tr><th>arangodb-java-driver</th><th>ArangoDB</th><th>network protocol</th><th>Java version</th></tr>
<tr><td>5.x.x+</td><td>3.0.0+</td><td>VelocyStream, HTTP</td><td>1.6+</td></tr>
<tr><td>4.2.x+</td><td>3.0.0+</td><td>VelocyStream, HTTP</td><td>1.6+</td></tr> <tr><td>4.2.x+</td><td>3.0.0+</td><td>VelocyStream, HTTP</td><td>1.6+</td></tr>
<tr><td>4.1.x</td><td>3.1.0+</td><td>VelocyStream</td><td>1.6+</td></tr> <tr><td>4.1.x</td><td>3.1.0+</td><td>VelocyStream</td><td>1.6+</td></tr>
<tr><td>3.1.x</td><td>3.1.0+</td><td>HTTP</td><td>1.6+</td></tr> <tr><td>3.1.x</td><td>3.1.0+</td><td>HTTP</td><td>1.6+</td></tr>
@ -26,7 +27,7 @@ ArangoDB 3.x.x
<dependency> <dependency>
<groupId>com.arangodb</groupId> <groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver</artifactId> <artifactId>arangodb-java-driver</artifactId>
<version>4.6.0</version> <version>5.0.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# ArangoDB Java Driver # ArangoDB Java Driver
The official ArangoDB Java Driver. The official ArangoDB Java Driver.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Bulk importing documents # Bulk importing documents
This function implements the This function implements the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating the collection # Manipulating the collection
These functions implement These functions implement
@ -73,8 +73,8 @@ Creates a collection with the given _options_ for this collection's name, then r
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
db.createCollection("potatoes", new CollectionCreateOptions()); db.createCollection("potatos", new CollectionCreateOptions());
// the document collection "potatoes" now exists // the document collection "potatos" now exists
``` ```
## ArangoCollection.create ## ArangoCollection.create
@ -144,9 +144,9 @@ Alternative for [ArangoDatabase.createCollection](#arangodatabasecreatecollectio
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
collection.create(new CollectionCreateOptions()); collection.create(new CollectionCreateOptions());
// the document collection "potatoes" now exists // the document collection "potatos" now exists
``` ```
## ArangoCollection.load ## ArangoCollection.load

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating documents # Manipulating documents
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating indexes # Manipulating indexes
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Collection API # Collection API
These functions implement the These functions implement the
@ -26,7 +26,7 @@ Checks whether the collection exists
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
boolean exists = collection.exists(); boolean exists = collection.exists();
``` ```
@ -44,7 +44,7 @@ Returns information about the collection.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
CollectionEntity info = collection.getInfo(); CollectionEntity info = collection.getInfo();
``` ```
@ -62,7 +62,7 @@ Reads the properties of the specified collection.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
CollectionPropertiesEntity properties = collection.getProperties(); CollectionPropertiesEntity properties = collection.getProperties();
``` ```
@ -80,7 +80,7 @@ Retrieve the collections revision.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
CollectionRevisionEntity revision = collection.getRevision(); CollectionRevisionEntity revision = collection.getRevision();
``` ```
@ -98,7 +98,7 @@ Fetches a list of all indexes on this collection.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoCollection collection = db.collection("potatoes"); ArangoCollection collection = db.collection("potatos");
Collection<IndexEntity> indexes = collection.getIndexes(); Collection<IndexEntity> indexes = collection.getIndexes();
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Cursor API # Cursor API
_ArangoCursor_ instances provide an abstraction over the HTTP API's limitations. Unless a method explicitly exhausts the cursor, the driver will only fetch as many batches from the server as necessary. Like the server-side cursors, _ArangoCursor_ instances are incrementally depleted as they are read from. _ArangoCursor_ instances provide an abstraction over the HTTP API's limitations. Unless a method explicitly exhausts the cursor, the driver will only fetch as many batches from the server as necessary. Like the server-side cursors, _ArangoCursor_ instances are incrementally depleted as they are read from.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Managing AQL user functions # Managing AQL user functions
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Accessing collections # Accessing collections
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulation databases # Manipulation databases
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Accessing graphs # Accessing graphs
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Arbitrary HTTP routes # Arbitrary HTTP routes
## ArangoDatabase.route ## ArangoDatabase.route

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Queries # Queries
This function implements the This function implements the
@ -78,7 +78,7 @@ Performs a database query using the given _query_ and _bindVars_, then returns a
- **fullCount**: `Boolean` - **fullCount**: `Boolean`
If set to true and the query contains a LIMIT clause, then the result will have an extra attribute with the sub-attributes stats and fullCount, { ... , "extra": { "stats": { "fullCount": 123 } } }. The fullCount attribute will contain the number of documents in the result before the last top-level LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount attribute may only be present in the result if the query has a top-level LIMIT clause and the LIMIT clause is actually used in the query. If set to true and the query contains a LIMIT clause, then the result will have an extra attribute with the sub-attributes stats and fullCount, { ... , "extra": { "stats": { "fullCount": 123 } } }. The fullCount attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query.
- **maxPlans**: `Integer` - **maxPlans**: `Integer`

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Database API # Database API
## ArangoDB.db ## ArangoDB.db

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Transactions # Transactions
This function implements the This function implements the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Accessing views # Accessing views
These functions implement the These functions implement the
@ -32,7 +32,7 @@ ArangoView view = db.view("myView");
ArangoDatabase.arangoSearch(String name) : ArangoSearch ArangoDatabase.arangoSearch(String name) : ArangoSearch
``` ```
Returns a _ArangoSearch_ instance for the given ArangoSearch View name. Returns a _ArangoSearch_ instance for the given ArangoSearch view name.
**Arguments** **Arguments**

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating the edge collection # Manipulating the edge collection
## ArangoGraph.edgeCollection ## ArangoGraph.edgeCollection

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating edges # Manipulating edges
## ArangoEdgeCollection.getEdge ## ArangoEdgeCollection.getEdge

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Graph API # Graph API
These functions implement the These functions implement the

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating the vertex collection # Manipulating the vertex collection
## ArangoGraph.vertexCollection ## ArangoGraph.vertexCollection

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating vertices # Manipulating vertices
## ArangoVertexCollection.getVertex ## ArangoVertexCollection.getVertex

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# ArangoDB Java Driver - Reference # ArangoDB Java Driver - Reference
- [Driver Setup](Setup.md) - [Driver Setup](Setup.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Route API # Route API
_ArangoRoute_ instances provide access for arbitrary HTTP requests. This allows easy access to Foxx services and other HTTP APIs not covered by the driver itself. _ArangoRoute_ instances provide access for arbitrary HTTP requests. This allows easy access to Foxx services and other HTTP APIs not covered by the driver itself.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Serialization # Serialization
## VelocyPack serialization ## VelocyPack serialization

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Driver setup # Driver setup
Setup with default configuration, this automatically loads a properties file arangodb.properties if exists in the classpath: Setup with default configuration, this automatically loads a properties file arangodb.properties if exists in the classpath:
@ -74,7 +74,7 @@ To use SSL, you have to set the configuration `useSsl` to `true` and set a `SSLC
## Connection Pooling ## Connection Pooling
The driver supports connection pooling for VelocyStream with a default of 1 and HTTP with a default of 20 maximum connections. To change this value use the method `maxConnections(Integer)` in `ArangoDB.Builder`. The driver supports connection pooling for VelocyStream with a default of 1 and HTTP with a default of 20 maximum connections per host. To change this value use the method `maxConnections(Integer)` in `ArangoDB.Builder`.
```Java ```Java
ArangoDB arangoDB = new ArangoDB.Builder().maxConnections(8).build(); ArangoDB arangoDB = new ArangoDB.Builder().maxConnections(8).build();
@ -104,16 +104,16 @@ Since version 4.3 the driver support acquiring a list of known hosts in a cluste
Since version 4.3 the driver supports load balancing for cluster setups in two different ways. Since version 4.3 the driver supports load balancing for cluster setups in two different ways.
The first one is a round robin load balancing where the driver iterates through a list of known hosts and performs every request on a different host than the request before. This load balancing strategy only work when the maximun of connections is greater 1. The first one is a round robin load balancing where the driver iterates through a list of known hosts and performs every request on a different host than the request before.
```Java ```Java
ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ROUND_ROBIN).maxConnections(8).build(); ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ROUND_ROBIN).build();
``` ```
Just like the Fallback hosts feature the round robin load balancing strategy can use the `acquireHostList` configuration to acquire a list of all known hosts in the cluster. Do so only requires the manually configuration of only one host. Because this list is updated frequently it makes load balancing over the whole cluster very comfortable. Just like the Fallback hosts feature the round robin load balancing strategy can use the `acquireHostList` configuration to acquire a list of all known hosts in the cluster. Do so only requires the manually configuration of only one host. Because this list is updated frequently it makes load balancing over the whole cluster very comfortable.
```Java ```Java
ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ROUND_ROBIN).maxConnections(8).acquireHostList(true).build(); ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ROUND_ROBIN).acquireHostList(true).build();
``` ```
The second load balancing strategy allows to pick a random host from the configured or acquired list of hosts and sticks to that host as long as the connection is open. This strategy is useful for an application - using the driver - which provides a session management where each session has its own instance of `ArangoDB` build from a global configured list of hosts. In this case it could be wanted that every sessions sticks with all its requests to the same host but not all sessions should use the same host. This load balancing strategy also works together with `acquireHostList`. The second load balancing strategy allows to pick a random host from the configured or acquired list of hosts and sticks to that host as long as the connection is open. This strategy is useful for an application - using the driver - which provides a session management where each session has its own instance of `ArangoDB` build from a global configured list of hosts. In this case it could be wanted that every sessions sticks with all its requests to the same host but not all sessions should use the same host. This load balancing strategy also works together with `acquireHostList`.
@ -124,7 +124,7 @@ The second load balancing strategy allows to pick a random host from the configu
## Connection time to live ## Connection time to live
Since version 4.4 the driver supports setting a TTL for connections managed by the internal connection pool. Setting a TTL helps when using load balancing strategy `ROUND_ROBIN`, because as soon as a coordinator goes down, every open connection to that host will be closed and opened again with another target coordinator. As long as the driver does not have to open new connections (all connections in the pool are used) it will use only the coordinators which never went down. To use the downed coordinator again, when it is running again, the connections in the connection pool have to be closed and opened again with the target host mentioned by the load balancing strategy. To achieve this you can manually call `ArangoDB.shutdown` in your client code or use the TTL for connection so that a downed coordinator (which is then brought up again) will be used again after a certain time. Since version 4.4 the driver supports setting a TTL for connections managed by the internal connection pool.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().connectionTtl(5 * 60 * 1000).build(); ArangoDB arango = new ArangoDB.Builder().connectionTtl(5 * 60 * 1000).build();

View File

@ -1,8 +1,8 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# ArangoSearch API # ArangoSearch API
These functions implement the These functions implement the
[HTTP API for ArangoSearch Views](../../../..//HTTP/Views/ArangoSearch.html). [HTTP API for ArangoSearch views](../../../..//HTTP/Views/ArangoSearch.html).
## ArangoDatabase.createArangoSearch ## ArangoDatabase.createArangoSearch
@ -10,7 +10,7 @@ These functions implement the
ArangoDatabase.createArangoSearch(String name, ArangoSearchCreateOptions options) : ViewEntity ArangoDatabase.createArangoSearch(String name, ArangoSearchCreateOptions options) : ViewEntity
``` ```
Creates a ArangoSearch View with the given _options_, then returns view information from the server. Creates a ArangoSearch view with the given _options_, then returns view information from the server.
**Arguments** **Arguments**
@ -20,11 +20,7 @@ Creates a ArangoSearch View with the given _options_, then returns view informat
- **options**: `ArangoSearchCreateOptions` - **options**: `ArangoSearchCreateOptions`
- **locale**: `String` - **consolidationIntervalMsec**: `Long`
The default locale used for queries on analyzed string values (default: C).
- **commitIntervalMsec**: `Long`
Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits. Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.
@ -32,17 +28,31 @@ Creates a ArangoSearch View with the given _options_, then returns view informat
Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits. Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.
- **threshold**: `ConsolidateThreshold[]` - **consolidationPolicy**:
A list of consolidate thresholds - **type**: `ConsolidationType`
The type of the consolidation policy.
- **threshold**: `Double`
Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
- **segmentThreshold**: `Long`
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments
- **link**: `CollectionLink[]`
A list of linked collections
**Examples** **Examples**
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
db.createArangoSearch("potatoes", new ArangoSearchPropertiesOptions()); db.createArangoSearch("potatos", new ArangoSearchPropertiesOptions());
// the ArangoSearch View "potatoes" now exists // the ArangoSearch view "potatos" now exists
``` ```
## ArangoSearch.create ## ArangoSearch.create
@ -51,19 +61,15 @@ db.createArangoSearch("potatoes", new ArangoSearchPropertiesOptions());
ArangoSearch.create(ArangoSearchCreateOptions options) : ViewEntity ArangoSearch.create(ArangoSearchCreateOptions options) : ViewEntity
``` ```
Creates a ArangoSearch View with the given _options_, then returns view information from the server. Creates a ArangoSearch view with the given _options_, then returns view information from the server.
Alternative for [ArangoDatabase.createArangoSearch](#arangodatabasecreatearangosearch). Alternative for `ArangoDatabase.createArangoSearch`.
**Arguments** **Arguments**
- **options**: `ArangoSearchCreateOptions` - **options**: `ArangoSearchCreateOptions`
- **locale**: `String` - **consolidationIntervalMsec**: `Long`
The default locale used for queries on analyzed string values (default: C).
- **commitIntervalMsec**: `Long`
Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits. Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.
@ -71,19 +77,33 @@ Alternative for [ArangoDatabase.createArangoSearch](#arangodatabasecreatearangos
Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits. Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.
- **threshold**: `ConsolidateThreshold[]` - **consolidationPolicy**:
A list of consolidate thresholds - **type**: `ConsolidationType`
The type of the consolidation policy.
- **threshold**: `Double`
Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
- **segmentThreshold**: `Long`
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments
- **link**: `CollectionLink[]`
A list of linked collections
**Examples** **Examples**
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("potatoes"); ArangoSearch view = db.arangoSearch("potatos");
view.create(new ArangoSearchPropertiesOptions()); view.create(new ArangoSearchPropertiesOptions());
// the ArangoSearch View "potatoes" now exists // the ArangoSearch view "potatos" now exists
``` ```
## ArangoSearch.getProperties ## ArangoSearch.getProperties
@ -99,7 +119,7 @@ Reads the properties of the specified view.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoSearch view = db.arangoSearch("potatoes"); ArangoSearch view = db.arangoSearch("potatos");
ArangoSearchPropertiesEntity properties = view.getProperties(); ArangoSearchPropertiesEntity properties = view.getProperties();
``` ```
@ -116,11 +136,7 @@ Partially changes properties of the view.
- **options**: `ArangoSearchPropertiesOptions` - **options**: `ArangoSearchPropertiesOptions`
- **locale**: `String` - **consolidationIntervalMsec**: `Long`
The default locale used for queries on analyzed string values (default: C).
- **commitIntervalMsec**: `Long`
Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits. Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.
@ -128,13 +144,23 @@ Partially changes properties of the view.
Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits. Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.
- **threshold**: `ConsolidateThreshold[]` - **consolidationPolicy**:
A list of consolidate thresholds - **type**: `ConsolidationType`
- **link**: `CollectionLink[]` The type of the consolidation policy.
A list of linked collections - **threshold**: `Double`
Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
- **segmentThreshold**: `Long`
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments
- **link**: `CollectionLink[]`
A list of linked collections
**Examples** **Examples**
@ -158,11 +184,7 @@ Changes properties of the view.
- **options**: `ArangoSearchPropertiesOptions` - **options**: `ArangoSearchPropertiesOptions`
- **locale**: `String` - **consolidationIntervalMsec**: `Long`
The default locale used for queries on analyzed string values (default: C).
- **commitIntervalMsec**: `Long`
Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits. Wait at least this many milliseconds between committing index data changes and making them visible to queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a lower value, until commit, will cause the index not to account for them and memory usage would continue to grow. For the case where there are a few inserts/updates, a higher value will impact performance and waste disk space for each commit call without any added benefits.
@ -170,13 +192,23 @@ Changes properties of the view.
Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits. Wait at least this many commits between removing unused files in data directory (default: 10, to disable use: 0). For the case where the consolidation policies merge segments often (i.e. a lot of commit+consolidate), a lower value will cause a lot of disk space to be wasted. For the case where the consolidation policies rarely merge segments (i.e. few inserts/deletes), a higher value will impact performance without any added benefits.
- **threshold**: `ConsolidateThreshold[]` - **consolidationPolicy**:
A list of consolidate thresholds - **type**: `ConsolidationType`
- **link**: `CollectionLink[]` The type of the consolidation policy.
A list of linked collections - **threshold**: `Double`
Select a given segment for "consolidation" if and only if the formula based on type (as defined above) evaluates to true, valid value range [0.0, 1.0] (default: 0.85)
- **segmentThreshold**: `Long`
Apply the "consolidation" operation if and only if (default: 300): {segmentThreshold} < number_of_segments
- **link**: `CollectionLink[]`
A list of linked collections
**Examples** **Examples**

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# View API # View API
These functions implement the These functions implement the
@ -23,7 +23,7 @@ Checks whether the view exists
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("potatoes"); ArangoView view = db.view("potatos");
boolean exists = view.exists(); boolean exists = view.exists();
``` ```
@ -41,7 +41,7 @@ Returns information about the view.
```Java ```Java
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
ArangoView view = db.view("potatoes"); ArangoView view = db.view("potatos");
ViewEntity info = view.getInfo(); ViewEntity info = view.getInfo();
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
# Manipulating the view # Manipulating the view
These functions implement These functions implement
@ -28,7 +28,7 @@ Creates a view of the given _type_, then returns view information from the serve
ArangoDB arango = new ArangoDB.Builder().build(); ArangoDB arango = new ArangoDB.Builder().build();
ArangoDatabase db = arango.db("myDB"); ArangoDatabase db = arango.db("myDB");
db.createView("myView", ViewType.ARANGO_SEARCH); db.createView("myView", ViewType.ARANGO_SEARCH);
// the view "potatoes" now exists // the view "potatos" now exists
``` ```
## ArangoView.rename ## ArangoView.rename

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ -->
# ArangoDB-PHP - Getting Started # ArangoDB-PHP - Getting Started
## Description ## Description

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ -->
# ArangoDB-PHP - A PHP client for ArangoDB # ArangoDB-PHP - A PHP client for ArangoDB
The official ArangoDB PHP Driver. The official ArangoDB PHP Driver.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-php.git / docs/Drivers/ -->
# ArangoDB-PHP - Tutorial # ArangoDB-PHP - Tutorial
## Setting up the connection options ## Setting up the connection options

View File

@ -5,7 +5,7 @@
## Official Drivers ## Official Drivers
# https://@github.com/arangodb/arangodb-java-driver.git;arangodb-java-driver;docs/Drivers;;/ <!-- SYNC: https://@github.com/arangodb/arangodb-java-driver.git;arangodb-java-driver;docs/Drivers;;/ -->
* [Java Driver](Java/README.md) * [Java Driver](Java/README.md)
* [Getting Started](Java/GettingStarted/README.md) * [Getting Started](Java/GettingStarted/README.md)
* [Reference](Java/Reference/README.md) * [Reference](Java/Reference/README.md)
@ -35,7 +35,7 @@
* [Edges Manipulation](Java/Reference/Graph/Edges.md) * [Edges Manipulation](Java/Reference/Graph/Edges.md)
* [Route](Java/Reference/Route.md) * [Route](Java/Reference/Route.md)
* [Serialization](Java/Reference/Serialization.md) * [Serialization](Java/Reference/Serialization.md)
# https://@github.com/arangodb/arangodbjs.git;arangodbjs;docs/Drivers;;/ <!-- SYNC: https://@github.com/arangodb/arangodbjs.git;arangodbjs;docs/Drivers;;/ -->
* [ArangoJS - JavaScript Driver](JS/README.md) * [ArangoJS - JavaScript Driver](JS/README.md)
* [Getting Started](JS/GettingStarted/README.md) * [Getting Started](JS/GettingStarted/README.md)
* [Reference](JS/Reference/README.md) * [Reference](JS/Reference/README.md)
@ -65,11 +65,11 @@
* [VertexCollection](JS/Reference/Graph/VertexCollection.md) * [VertexCollection](JS/Reference/Graph/VertexCollection.md)
* [EdgeCollection](JS/Reference/Graph/EdgeCollection.md) * [EdgeCollection](JS/Reference/Graph/EdgeCollection.md)
* [Route](JS/Reference/Route.md) * [Route](JS/Reference/Route.md)
# https://@github.com/arangodb/arangodb-php.git;arangodb-php;docs/Drivers;;/ <!-- SYNC: https://@github.com/arangodb/arangodb-php.git;arangodb-php;docs/Drivers;;/ -->
* [ArangoDB-PHP](PHP/README.md) * [ArangoDB-PHP](PHP/README.md)
* [Getting Started](PHP/GettingStarted/README.md) * [Getting Started](PHP/GettingStarted/README.md)
* [Tutorial](PHP/Tutorial/README.md) * [Tutorial](PHP/Tutorial/README.md)
# https://@github.com/arangodb/go-driver.git;go-driver;docs/Drivers;;/ <!-- SYNC: https://@github.com/arangodb/go-driver.git;go-driver;docs/Drivers;;/ -->
* [ArangoDB Go Driver](GO/README.md) * [ArangoDB Go Driver](GO/README.md)
* [Getting Started](GO/GettingStarted/README.md) * [Getting Started](GO/GettingStarted/README.md)
* [Example Requests](GO/ExampleRequests/README.md) * [Example Requests](GO/ExampleRequests/README.md)
@ -77,7 +77,7 @@
## Integrations ## Integrations
# https://@github.com/arangodb/spring-data.git;spring-data;docs/Drivers;;/ <!-- SYNC: https://@github.com/arangodb/spring-data.git;spring-data;docs/Drivers;;/ -->
* [Spring Data ArangoDB](SpringData/README.md) * [Spring Data ArangoDB](SpringData/README.md)
* [Getting Started](SpringData/GettingStarted/README.md) * [Getting Started](SpringData/GettingStarted/README.md)
* [Reference](SpringData/Reference/README.md) * [Reference](SpringData/Reference/README.md)
@ -102,13 +102,14 @@
* [Indexes](SpringData/Reference/Mapping/Indexes.md) * [Indexes](SpringData/Reference/Mapping/Indexes.md)
* [Converter](SpringData/Reference/Mapping/Converter.md) * [Converter](SpringData/Reference/Mapping/Converter.md)
* [Events](SpringData/Reference/Mapping/Events.md) * [Events](SpringData/Reference/Mapping/Events.md)
* [Auditing](SpringData/Reference/Mapping/Auditing.md)
* [Migration](SpringData/Migration/README.md) * [Migration](SpringData/Migration/README.md)
* [Migrating 1.x to 3.0](SpringData/Migration/Migrating-1.x-3.0.md) * [Migrating 1.x to 3.0](SpringData/Migration/Migrating-1.x-3.0.md)
* [Migrating 2.x to 3.0](SpringData/Migration/Migrating-2.x-3.0.md) * [Migrating 2.x to 3.0](SpringData/Migration/Migrating-2.x-3.0.md)
<!-- SYNC: https://@github.com/arangodb/arangodb-spark-connector.git;arangodb-spark-connector;docs/Drivers;;/ -->
# https://@github.com/arangodb/arangodb-spark-connector.git;arangodb-spark-connector;docs/Drivers;;/
* [ArangoDB Spark Connector](SparkConnector/README.md) * [ArangoDB Spark Connector](SparkConnector/README.md)
* [Getting Started](SparkConnector/GettingStarted/README.md) * [Getting Started](SparkConnector/GettingStarted/README.md)
* [Reference](SparkConnector/Reference/README.md) * [Reference](SparkConnector/Reference/README.md)
* [Java](SparkConnector/Reference/Java.md) * [Java](SparkConnector/Reference/Java.md)
* [Scala](SparkConnector/Reference/Scala.md) * [Scala](SparkConnector/Reference/Scala.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ -->
# ArangoDB Spark Connector - Getting Started # ArangoDB Spark Connector - Getting Started
## Maven ## Maven
@ -27,6 +27,7 @@ libraryDependencies += "com.arangodb" % "arangodb-spark-connector" % "1.0.2"
| arangodb.hosts | comma separated list of ArangoDB hosts | 127.0.0.1:8529 | | arangodb.hosts | comma separated list of ArangoDB hosts | 127.0.0.1:8529 |
| arangodb.user | basic authentication user | root | | arangodb.user | basic authentication user | root |
| arangodb.password | basic authentication password | | | arangodb.password | basic authentication password | |
| arangodb.protocol | network protocol | VST |
| arangodb.useSsl | use SSL connection | false | | arangodb.useSsl | use SSL connection | false |
| arangodb.ssl.keyStoreFile | SSL certificate keystore file | | | arangodb.ssl.keyStoreFile | SSL certificate keystore file | |
| arangodb.ssl.passPhrase | SSL pass phrase | | | arangodb.ssl.passPhrase | SSL pass phrase | |

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ -->
# ArangoDB Spark Connector # ArangoDB Spark Connector
- [Getting Started](GettingStarted/README.md) - [Getting Started](GettingStarted/README.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ -->
# ArangoDB Spark Connector - Java Reference # ArangoDB Spark Connector - Java Reference
## ArangoSpark.save ## ArangoSpark.save

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ -->
# ArangoDB Spark Connector - Reference # ArangoDB Spark Connector - Reference
- [Scala](Scala.md) - [Scala](Scala.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangodb-spark-connector.git / docs/Drivers/ -->
# ArangoDB Spark Connector - Scala Reference # ArangoDB Spark Connector - Scala Reference
## ArangoSpark.save ## ArangoSpark.save

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Spring Data ArangoDB - Getting Started # Spring Data ArangoDB - Getting Started
## Supported versions ## Supported versions
@ -24,7 +24,7 @@ To use Spring Data ArangoDB in your project, your build automation tool needs to
<dependency> <dependency>
<groupId>com.arangodb</groupId> <groupId>com.arangodb</groupId>
<artifactId>arangodb-spring-data</artifactId> <artifactId>arangodb-spring-data</artifactId>
<version>2.3.1</version> <version>3.1.0</version>
</dependency> </dependency>
``` ```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Migrating Spring Data ArangoDB 2.x to 3.0 # Migrating Spring Data ArangoDB 1.x to 3.0
see [Migrating 2.x to 3.0](Migrating-2.x-3.0.md) see [Migrating 2.x to 3.0](Migrating-2.x-3.0.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Migrating Spring Data ArangoDB 2.x to 3.0 # Migrating Spring Data ArangoDB 2.x to 3.0
## Annotations @Key ## Annotations @Key

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Spring Data ArangoDB - Migration # Spring Data ArangoDB - Migration
- [Migrating 1.x to 3.0](Migrating-1.x-3.0.md) - [Migrating 1.x to 3.0](Migrating-1.x-3.0.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Spring Data ArangoDB # Spring Data ArangoDB
- [Getting Started](GettingStarted/README.md) - [Getting Started](GettingStarted/README.md)

View File

@ -0,0 +1,78 @@
<!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Auditing
Since version 3.0.0 Spring Data ArangoDB provides basic auditing functionallity where you can track who made changes on your data and when.
To enable auditing you have to add the annotation `@EnableArangoAuditing` to your configuration class.
```Java
@Configuration
@EnableArangoAuditing
public class MyConfiguration extends AbstractArangoConfiguration {
```
We can now add fields to our model classes and annotade them with `@CreateDate`, `@CreatedBy`, `@LastModifiedDate` and `@LastModifiedBy` to store the auditing information. All annotation names should be self-explanatory.
```Java
@Document
public class MyEntity {
@CreatedDate
private Instant created;
@CreatedBy
private User createdBy;
@LastModifiedDate
private Instant modified;
@LastModifiedBy
private User modifiedBy;
}
```
The annotations `@CreateDate` and `@LastModifiedDate` are working with fields of any kind of Date/Timestamp type which is supported by Spring Data. (i.e. `java.util.Date`, `java.time.Instant`, `java.time.LocalDateTime`).
For `@CreatedBy` and `@LastModifiedBy` we need to provide Spring Data the information of the current auditor (i.e. `User` in our case). We can do so by implementing the `AuditorAware` interface
```Java
public class AuditorProvider implements AuditorAware<User> {
@Override
public Optional<User> getCurrentAuditor() {
// return current user
}
}
```
and add the implementation as a bean to our Spring context.
```Java
@Configuration
@EnableArangoAuditing(auditorAwareRef = "auditorProvider")
public class MyConfiguration extends AbstractArangoConfiguration {
@Bean
public AuditorAware<User> auditorProvider() {
return new AuditorProvider();
}
}
```
If you use a type in your `AuditorAware` implementation, which will be also persisted in your database and you only want to save a reference in your entity, just add the [@Ref annotation](Reference.md) to the fields annotated with `@CreatedBy` and `@LastModifiedBy`. Keep in mind that you have to save the `User` in your database first to get a valid reference.
```Java
@Document
public class MyEntity {
@Ref
@CreatedBy
private User createdBy;
@Ref
@LastModifiedBy
private User modifiedBy;
}
```

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Converter # Converter
## Registering a Spring Converter ## Registering a Spring Converter

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Document # Document
## Annotation @Document ## Annotation @Document

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Edge # Edge
## Annotation @Edge ## Annotation @Edge

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Events # Events
Spring Data ArangoDB includes several `ApplicationEvent` events that your application can respond to by registering subclasses of `AbstractArangoEventListener` in the ApplicationContext. Spring Data ArangoDB includes several `ApplicationEvent` events that your application can respond to by registering subclasses of `AbstractArangoEventListener` in the ApplicationContext.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Indexes # Indexes
## Annotation @\<IndexType\>Indexed ## Annotation @\<IndexType\>Indexed

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Mapping # Mapping
In this section we will describe the features and conventions for mapping Java objects to documents and how to override those conventions with annotation based mapping metadata. In this section we will describe the features and conventions for mapping Java objects to documents and how to override those conventions with annotation based mapping metadata.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Reference # Reference
With the annotation `@Ref` applied on a field the nested object isnt stored as a nested object in the document. The `_id` field of the nested object is stored in the document and the nested object has to be stored as a separate document in another collection described in the `@Document` annotation of the nested object class. To successfully persist an instance of your object the referencing field has to be null or it's instance has to provide a field with the annotation `@Id` including a valid id. With the annotation `@Ref` applied on a field the nested object isnt stored as a nested object in the document. The `_id` field of the nested object is stored in the document and the nested object has to be stored as a separate document in another collection described in the `@Document` annotation of the nested object class. To successfully persist an instance of your object the referencing field has to be null or it's instance has to provide a field with the annotation `@Id` including a valid id.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Relations # Relations
With the annotation `@Relations` applied on a collection or array field in a class annotated with `@Document` the nested objects are fetched from the database over a graph traversal with your current object as the starting point. The most relevant parameter is `edge`. With `edge` you define the edge collection - which should be used in the traversal - using the class type. With the parameter `depth` you can define the maximal depth for the traversal (default 1) and the parameter `direction` defines whether the traversal should follow outgoing or incoming edges (default Direction.ANY). With the annotation `@Relations` applied on a collection or array field in a class annotated with `@Document` the nested objects are fetched from the database over a graph traversal with your current object as the starting point. The most relevant parameter is `edge`. With `edge` you define the edge collection - which should be used in the traversal - using the class type. With the parameter `depth` you can define the maximal depth for the traversal (default 1) and the parameter `direction` defines whether the traversal should follow outgoing or incoming edges (default Direction.ANY).

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Spring Data ArangoDB - Reference # Spring Data ArangoDB - Reference
- [Template](Template/README.md) - [Template](Template/README.md)
@ -22,3 +22,4 @@
- [Indexes](Mapping/Indexes.md) - [Indexes](Mapping/Indexes.md)
- [Converter](Mapping/Converter.md) - [Converter](Mapping/Converter.md)
- [Events](Mapping/Events.md) - [Events](Mapping/Events.md)
- [Auditing](Mapping/Auditing.md)

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Manipulating documents # Manipulating documents
## ArangoRepository.existsById ## ArangoRepository.existsById

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Manipulating multiple documents # Manipulating multiple documents
## ArangoRepository.findAll ## ArangoRepository.findAll

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Derived queries # Derived queries
## Semantic parts ## Semantic parts

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Named queries # Named queries
An alternative to using the `@Query` annotation on methods is specifying them in a separate `.properties` file. The default path for the file is `META-INF/arango-named-queries.properties` and can be changed with the `EnableArangoRepositories#namedQueriesLocation()` setting. The entries in the properties file must adhere to the following convention: `{simple entity name}.{method name} = {query}`. Let's assume we have the following repository interface: An alternative to using the `@Query` annotation on methods is specifying them in a separate `.properties` file. The default path for the file is `META-INF/arango-named-queries.properties` and can be changed with the `EnableArangoRepositories#namedQueriesLocation()` setting. The entries in the properties file must adhere to the following convention: `{simple entity name}.{method name} = {query}`. Let's assume we have the following repository interface:

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Query methods # Query methods
Queries using [ArangoDB Query Language (AQL)](https://docs.arangodb.com/current/AQL/index.html) can be supplied with the `@Query` annotation on methods. Queries using [ArangoDB Query Language (AQL)](https://docs.arangodb.com/current/AQL/index.html) can be supplied with the `@Query` annotation on methods.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Queries # Queries
Spring Data ArangoDB supports three kinds of queries: Spring Data ArangoDB supports three kinds of queries:

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Query by example # Query by example
## ArangoRepository.exists ## ArangoRepository.exists

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Repositories # Repositories
Spring Data Commons provides a composable repository infrastructure which Spring Data ArangoDB is built on. These allow for interface-based composition of repositories consisting of provided default implementations for certain interfaces (like `CrudRepository`) and custom implementations for other methods. Spring Data Commons provides a composable repository infrastructure which Spring Data ArangoDB is built on. These allow for interface-based composition of repositories consisting of provided default implementations for certain interfaces (like `CrudRepository`) and custom implementations for other methods.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Manipulating the collection # Manipulating the collection
## ArangoOperations.collection ## ArangoOperations.collection

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Manipulating documents # Manipulating documents
## ArangoOperations.exists ## ArangoOperations.exists

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Manipulating multiple documents # Manipulating multiple documents
## ArangoOperations.find ## ArangoOperations.find

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
## ArangoOperations.query ## ArangoOperations.query
``` ```
@ -73,7 +73,7 @@ Performs a database query using the given _query_ and _bindVars_, then returns a
- **fullCount**: `Boolean` - **fullCount**: `Boolean`
If set to true and the query contains a LIMIT clause, then the result will have an extra attribute with the sub-attributes stats and fullCount, { ... , "extra": { "stats": { "fullCount": 123 } } }. The fullCount attribute will contain the number of documents in the result before the last top-level LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount attribute may only be present in the result if the query has a top-level LIMIT clause and the LIMIT clause is actually used in the query. If set to true and the query contains a LIMIT clause, then the result will have an extra attribute with the sub-attributes stats and fullCount, { ... , "extra": { "stats": { "fullCount": 123 } } }. The fullCount attribute will contain the number of documents in the result before the last LIMIT in the query was applied. It can be used to count the number of documents that match certain filter criteria, but only return a subset of them, in one go. It is thus similar to MySQL's SQL_CALC_FOUND_ROWS hint. Note that setting the option will disable a few LIMIT optimizations and may lead to more documents being processed, and thus make queries run longer. Note that the fullCount attribute will only be present in the result if the query has a LIMIT clause and the LIMIT clause is actually used in the query.
- **maxPlans**: `Integer` - **maxPlans**: `Integer`

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ --> <!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
# Template # Template
With `ArangoTemplate` Spring Data ArangoDB offers a central support for interactions with the database over a rich feature set. It mostly offers the features from the ArangoDB Java driver with additional exception translation from the drivers exceptions to the Spring Data access exceptions inheriting the `DataAccessException` class. With `ArangoTemplate` Spring Data ArangoDB offers a central support for interactions with the database over a rich feature set. It mostly offers the features from the ArangoDB Java driver with additional exception translation from the drivers exceptions to the Spring Data access exceptions inheriting the `DataAccessException` class.

View File

@ -1,4 +1,4 @@
<!-- don't edit here, its from https://@github.com/arangodb/arangosync.git / docs/Manual/ --> <!-- don't edit here, it's from https://@github.com/arangodb/arangosync.git / docs/Manual/ -->
# Datacenter to datacenter replication administration # Datacenter to datacenter replication administration
{% hint 'info' %} {% hint 'info' %}
@ -104,10 +104,20 @@ arangosync stop sync \
--auth.password=<password of auth.user> --auth.password=<password of auth.user>
``` ```
The command will wait until synchronization has completely stopped before returning. The command will first ensure that all shards in the receiving cluster are
completely in-sync with the shards in the sending cluster.
In order to achieve that, the sending cluster will be switched to read/only mode.
After the synchronization has stopped, the sending cluster will be switched
back to read/write mode.
The command will then wait until synchronization has completely stopped before returning.
If the synchronization is not completely stopped within a reasonable period (2 minutes by default) If the synchronization is not completely stopped within a reasonable period (2 minutes by default)
the command will fail. the command will fail.
If you do not want to wait for all shards in the receiving cluster to be
completely in-sync with the shards in the sending cluster, add an `--ensure-in-sync=false`
argument to the `stop sync` command.
If the source datacenter is no longer available it is not possible to stop synchronization in If the source datacenter is no longer available it is not possible to stop synchronization in
a graceful manner. If that happens abort the synchronization with the following command: a graceful manner. If that happens abort the synchronization with the following command:

Some files were not shown because too many files have changed in this diff Show More