mirror of https://gitee.com/bigwinds/arangodb
Doc - Sync external repos 2018-09-26 (#6476)
This commit is contained in:
parent
ed04451739
commit
fd1019c51e
|
@ -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
|
||||
## Failover
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
## Connecting to ArangoDB
|
||||
|
|
|
@ -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
|
||||
|
||||
## Supported versions
|
||||
|
|
|
@ -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
|
||||
|
||||
The official [ArangoDB](https://arangodb.com) GO Driver
|
||||
|
|
|
@ -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
|
||||
|
||||
## Compatibility
|
||||
|
||||
ArangoJS is compatible with ArangoDB 3.0 and later. **For using ArangoJS with
|
||||
2.8 or earlier see the upgrade note below.** ArangoJS is tested against the two
|
||||
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.
|
||||
ArangoJS is compatible with the latest stable version of ArangoDB available at
|
||||
the time of the driver release.
|
||||
|
||||
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
|
||||
(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.
|
||||
|
||||
**Upgrade note**: If you want to use arangojs with ArangoDB 2.8 or earlier
|
||||
remember to set the appropriate `arangoVersion` option (e.g. `20800` for version
|
||||
2.8.0). The current default value is `30000` (indicating compatibility with
|
||||
version 3.0.0 and newer). **The driver will behave differently depending on this
|
||||
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)
|
||||
**Note**: Starting with arangojs 6.0.0, all asynchronous functions return
|
||||
promises. 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.
|
||||
|
||||
## Versions
|
||||
|
@ -35,11 +34,11 @@ The version number of this driver does not indicate supported ArangoDB versions!
|
|||
|
||||
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.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
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
|
||||
[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
|
||||
|
||||
### With Yarn or NPM
|
||||
|
@ -171,11 +149,10 @@ const db = new Database();
|
|||
var arangojs = require("arangojs");
|
||||
var db = new arangojs.Database();
|
||||
var now = Date.now();
|
||||
db
|
||||
.query({
|
||||
query: "RETURN @value",
|
||||
bindVars: { value: now }
|
||||
})
|
||||
db.query({
|
||||
query: "RETURN @value",
|
||||
bindVars: { value: now }
|
||||
})
|
||||
.then(function(cursor) {
|
||||
return cursor.next().then(function(result) {
|
||||
// ...
|
||||
|
@ -213,7 +190,9 @@ AQL queries without making your code vulnerable to injection attacks.
|
|||
## Error responses
|
||||
|
||||
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
|
||||
_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_
|
||||
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**
|
||||
|
||||
```js
|
||||
// Using async/await
|
||||
try {
|
||||
const info = await db.createDatabase('mydb');
|
||||
const info = await db.createDatabase("mydb");
|
||||
// database created
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
|
||||
// Using promises with arrow functions
|
||||
db.createDatabase('mydb')
|
||||
.then(
|
||||
db.createDatabase("mydb").then(
|
||||
info => {
|
||||
// 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.
|
||||
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 %}
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
**outside** the database.
|
||||
|
||||
* [Getting Started](GettingStarted/README.md)
|
||||
* [Reference](Reference/README.md)
|
||||
* [Changelog](https://github.com/arangodb/arangojs/blob/master/CHANGELOG.md#readme)
|
||||
- [Getting Started](GettingStarted/README.md)
|
||||
- [Reference](Reference/README.md)
|
||||
- [Changelog](https://github.com/arangodb/arangojs/blob/master/CHANGELOG.md#readme)
|
||||
|
|
|
@ -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
|
||||
|
||||
This function implements the
|
||||
|
@ -12,90 +12,140 @@ Bulk imports the given _data_ into the collection.
|
|||
|
||||
**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
|
||||
[
|
||||
{key1: value1, key2: value2}, // document 1
|
||||
{key1: value1, key2: value2}, // document 2
|
||||
...
|
||||
]
|
||||
```
|
||||
For type `"documents"` or `"auto"`:
|
||||
|
||||
Or it can be an array of value arrays following an array of keys.
|
||||
- an array of documents, e.g.
|
||||
|
||||
```js
|
||||
[
|
||||
['key1', 'key2'], // key names
|
||||
[value1, value2], // document 1
|
||||
[value1, value2], // document 2
|
||||
...
|
||||
]
|
||||
```
|
||||
```json
|
||||
[
|
||||
{ "_key": "banana", "color": "yellow" },
|
||||
{ "_key": "peach", "color": "pink" }
|
||||
]
|
||||
```
|
||||
|
||||
* **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:
|
||||
|
||||
* **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.
|
||||
|
||||
* **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
|
||||
could not be imported.false\*.
|
||||
could not be imported.
|
||||
|
||||
* **type**: `string` (Default: `"auto"`)
|
||||
|
||||
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).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for bulk imports](../../../..//HTTP/BulkImports/index.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('users');
|
||||
const collection = db.collection("users");
|
||||
|
||||
// document stream
|
||||
const result = await collection.import([
|
||||
{username: 'admin', password: 'hunter2'},
|
||||
{username: 'jcd', password: 'bionicman'},
|
||||
{username: 'jreyes', password: 'amigo'},
|
||||
{username: 'ghermann', password: 'zeitgeist'}
|
||||
]);
|
||||
assert.equal(result.created, 4);
|
||||
const result = await collection.import(
|
||||
[
|
||||
{ username: "jcd", password: "bionicman" },
|
||||
{ username: "jreyes", password: "amigo" },
|
||||
{ username: "ghermann", password: "zeitgeist" }
|
||||
],
|
||||
{ type: "documents" } // optional
|
||||
);
|
||||
|
||||
// -- or --
|
||||
|
||||
// array stream with header
|
||||
const result = await collection.import([
|
||||
['username', 'password'], // keys
|
||||
['admin', 'hunter2'], // row 1
|
||||
['jcd', 'bionicman'], // row 2
|
||||
['jreyes', 'amigo'],
|
||||
['ghermann', 'zeitgeist']
|
||||
]);
|
||||
assert.equal(result.created, 4);
|
||||
const buf = fs.readFileSync("dx_users.json");
|
||||
// [
|
||||
// {"username": "jcd", "password": "bionicman"},
|
||||
// {"username": "jreyes", "password": "amigo"},
|
||||
// {"username": "ghermann", "password": "zeitgeist"}
|
||||
// ]
|
||||
const result = await collection.import(
|
||||
buf,
|
||||
{ type: "array" } // optional
|
||||
);
|
||||
|
||||
// -- or --
|
||||
|
||||
// raw line-delimited JSON array stream with header
|
||||
const result = await collection.import([
|
||||
'["username", "password"]',
|
||||
'["admin", "hunter2"]',
|
||||
'["jcd", "bionicman"]',
|
||||
'["jreyes", "amigo"]',
|
||||
'["ghermann", "zeitgeist"]'
|
||||
].join('\r\n') + '\r\n');
|
||||
assert.equal(result.created, 4);
|
||||
const result = await collection.import(
|
||||
[
|
||||
["username", "password"],
|
||||
["jcd", "bionicman"],
|
||||
["jreyes", "amigo"],
|
||||
["ghermann", "zeitgeist"]
|
||||
],
|
||||
{ type: null } // required
|
||||
);
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement
|
||||
[the HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
|
||||
These functions implement the
|
||||
[HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
|
||||
|
||||
## collection.create
|
||||
|
||||
|
@ -15,8 +15,8 @@ then returns the server response.
|
|||
|
||||
- **properties**: `Object` (optional)
|
||||
|
||||
For more information on the _properties_ object, see
|
||||
[the HTTP API documentation for creating collections](../../../..//HTTP/Collection/Creating.html).
|
||||
For more information on the _properties_ object, see the
|
||||
[HTTP API documentation for creating collections](../../../..//HTTP/Collection/Creating.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -82,8 +82,8 @@ Replaces the properties of the collection.
|
|||
|
||||
- **properties**: `Object`
|
||||
|
||||
For information on the _properties_ argument see
|
||||
[the HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
|
||||
For information on the _properties_ argument see the
|
||||
[HTTP API for modifying collections](../../../..//HTTP/Collection/Modifying.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -162,9 +162,10 @@ Deletes the collection from the database.
|
|||
|
||||
This parameter must be set to `true` when dropping a system collection.
|
||||
|
||||
For more information on the _properties_ object, see
|
||||
[the HTTP API documentation for dropping collections](../../../..//HTTP/Collection/Creating.html#drops-a-collection).
|
||||
**Examples**
|
||||
For more information on the _properties_ object, see the
|
||||
[HTTP API documentation for dropping collections](../../../..//HTTP/Collection/Creating.html#drops-a-collection).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
the _returnNew_ option.
|
||||
|
||||
For more information on the _opts_ object, see
|
||||
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -11,56 +11,57 @@ These functions implement the
|
|||
Replaces the content of the document with the given _documentHandle_ with the
|
||||
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**
|
||||
|
||||
* **documentHandle**: `string`
|
||||
- **documentHandle**: `string`
|
||||
|
||||
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
|
||||
`_id` or `_key` property).
|
||||
|
||||
* **newValue**: `Object`
|
||||
- **newValue**: `Object`
|
||||
|
||||
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:
|
||||
|
||||
* **waitForSync**: `boolean` (Default: `false`)
|
||||
- **waitForSync**: `boolean` (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.
|
||||
|
||||
* **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.
|
||||
* 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.
|
||||
|
||||
If a string is passed instead of an options object, it will be interpreted as
|
||||
the _rev_ option.
|
||||
|
||||
For more information on the _opts_ object, see
|
||||
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const data = {number: 1, hello: 'world'};
|
||||
const collection = db.collection("some-collection");
|
||||
const data = { number: 1, hello: "world" };
|
||||
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.notEqual(info2._rev, info1._rev);
|
||||
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
|
||||
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**
|
||||
|
||||
* **documentHandle**: `string`
|
||||
- **documentHandle**: `string`
|
||||
|
||||
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`
|
||||
or `_key` property).
|
||||
|
||||
* **newValue**: `Object`
|
||||
- **newValue**: `Object`
|
||||
|
||||
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:
|
||||
|
||||
* **waitForSync**: `boolean` (Default: `false`)
|
||||
- **waitForSync**: `boolean` (Default: `false`)
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
documents are ignored. If this is set to false, then any _rev attribute
|
||||
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
|
||||
given in a body document is taken as a precondition. The document is only
|
||||
updated if the current revision is the one specified.
|
||||
|
||||
* **rev**: `string` (optional)
|
||||
- **rev**: `string` (optional)
|
||||
|
||||
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.
|
||||
* 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.
|
||||
|
||||
If a string is passed instead of an options object, it will be interpreted as
|
||||
the _rev_ option.
|
||||
|
||||
For more information on the _opts_ object, see
|
||||
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const doc = {number: 1, hello: 'world'};
|
||||
const collection = db.collection("some-collection");
|
||||
const doc = { number: 1, hello: "world" };
|
||||
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.notEqual(doc2._rev, doc1._rev);
|
||||
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
|
||||
returns an array containing the documents' metadata.
|
||||
|
||||
**Note**: This method is new in 3.0 and is available when using the driver with
|
||||
ArangoDB 3.0 and higher.
|
||||
{% hint 'info' %}
|
||||
This method is only available when targeting ArangoDB 3.0 or later,
|
||||
see [Compatibility](../../GettingStarted/README.md#compatibility).
|
||||
{% endhint %}
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **documents**: `Array<Object>`
|
||||
- **documents**: `Array<Object>`
|
||||
|
||||
Documents to update. Each object must have either the `_id` or the `_key`
|
||||
property.
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
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.
|
||||
|
||||
* **keepNull**: `boolean` (Default: `true`)
|
||||
- **keepNull**: `boolean` (Default: `true`)
|
||||
|
||||
If set to `false`, properties with a value of `null` indicate that a
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
documents are ignored. If this is set to false, then any _rev attribute
|
||||
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
|
||||
given in a body document is taken as a precondition. The document is only
|
||||
updated if the current revision is the one specified.
|
||||
|
||||
For more information on the _opts_ object, see
|
||||
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const doc1 = {number: 1, hello: 'world1'};
|
||||
const collection = db.collection("some-collection");
|
||||
const doc1 = { number: 1, hello: "world1" };
|
||||
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 result = await collection.bulkUpdate([
|
||||
{_key: info1._key, number: 3},
|
||||
{_key: info2._key, number: 4}
|
||||
], {returnNew: true})
|
||||
const result = await collection.bulkUpdate(
|
||||
[{ _key: info1._key, number: 3 }, { _key: info2._key, number: 4 }],
|
||||
{ returnNew: true }
|
||||
);
|
||||
```
|
||||
|
||||
## collection.remove
|
||||
|
@ -240,56 +244,57 @@ const result = await collection.bulkUpdate([
|
|||
|
||||
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**
|
||||
|
||||
* **documentHandle**: `string`
|
||||
- **documentHandle**: `string`
|
||||
|
||||
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
|
||||
`_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:
|
||||
|
||||
* **waitForSync**: `boolean` (Default: `false`)
|
||||
- **waitForSync**: `boolean` (Default: `false`)
|
||||
|
||||
Wait until document has been synced to disk.
|
||||
|
||||
* **rev**: `string` (optional)
|
||||
- **rev**: `string` (optional)
|
||||
|
||||
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.
|
||||
* 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.
|
||||
|
||||
If a string is passed instead of an options object, it will be interpreted as
|
||||
the _rev_ option.
|
||||
|
||||
For more information on the _opts_ object, see
|
||||
[the HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
For more information on the _opts_ object, see the
|
||||
[HTTP API documentation for working with documents](../../../..//HTTP/Document/WorkingWithDocuments.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
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
|
||||
|
||||
// -- or --
|
||||
|
||||
await collection.remove('some-collection/some-doc');
|
||||
await collection.remove("some-collection/some-doc");
|
||||
// document 'some-collection/some-doc' no longer exists
|
||||
```
|
||||
|
||||
|
@ -301,13 +306,13 @@ Retrieves a list of references for all documents in the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **type**: `string` (Default: `"id"`)
|
||||
- **type**: `string` (Default: `"id"`)
|
||||
|
||||
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.
|
||||
* 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.
|
||||
* 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.
|
||||
|
|
|
@ -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
|
||||
|
||||
The _EdgeCollection API_ extends the
|
||||
|
@ -79,7 +79,7 @@ if (exists === false) {
|
|||
|
||||
## 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
|
||||
_data_ and returns an object containing the edge's metadata.
|
||||
|
@ -275,8 +275,8 @@ contained in this edge collection.
|
|||
|
||||
- **opts**: `Object`
|
||||
|
||||
See
|
||||
[the HTTP API documentation](../../../..//HTTP/Traversal/index.html)
|
||||
See the
|
||||
[HTTP API documentation](../../../..//HTTP/Traversal/index.html)
|
||||
for details on the additional arguments.
|
||||
|
||||
Please note that while _opts.filter_, _opts.visitor_, _opts.init_,
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -12,17 +12,20 @@ Creates an arbitrary index on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **details**: `Object`
|
||||
- **details**: `Object`
|
||||
|
||||
For information on the possible properties of the _details_ object, see
|
||||
[the HTTP API for manipulating indexes](../../../..//HTTP/Indexes/WorkingWith.html).
|
||||
For information on the possible properties of the _details_ object, see the
|
||||
[HTTP API for manipulating indexes](../../../..//HTTP/Indexes/WorkingWith.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const index = await collection.createIndex({type: 'hash', fields: ['a', 'a.b']});
|
||||
const collection = db.collection("some-collection");
|
||||
const index = await collection.createIndex({
|
||||
type: "hash",
|
||||
fields: ["a", "a.b"]
|
||||
});
|
||||
// the index has been created with the handle `index.id`
|
||||
```
|
||||
|
||||
|
@ -34,34 +37,34 @@ Creates a hash index on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fields**: `Array<string>`
|
||||
- **fields**: `Array<string>`
|
||||
|
||||
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.
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
Additional options for this index. If the value is a boolean, it will be
|
||||
interpreted as _opts.unique_.
|
||||
|
||||
For more information on hash indexes, see
|
||||
[the HTTP API for hash indexes](../../../..//HTTP/Indexes/Hash.html).
|
||||
For more information on hash indexes, see the
|
||||
[HTTP API for hash indexes](../../../..//HTTP/Indexes/Hash.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
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`
|
||||
assert.deepEqual(index.fields, ['favorite-color']);
|
||||
assert.deepEqual(index.fields, ["favorite-color"]);
|
||||
|
||||
// -- 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`
|
||||
assert.deepEqual(index.fields, ['favorite-color']);
|
||||
assert.deepEqual(index.fields, ["favorite-color"]);
|
||||
```
|
||||
|
||||
## collection.createSkipList
|
||||
|
@ -72,34 +75,34 @@ Creates a skiplist index on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fields**: `Array<string>`
|
||||
- **fields**: `Array<string>`
|
||||
|
||||
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.
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
Additional options for this index. If the value is a boolean, it will be
|
||||
interpreted as _opts.unique_.
|
||||
|
||||
For more information on skiplist indexes, see
|
||||
[the HTTP API for skiplist indexes](../../../..//HTTP/Indexes/Skiplist.html).
|
||||
For more information on skiplist indexes, see the
|
||||
[HTTP API for skiplist indexes](../../../..//HTTP/Indexes/Skiplist.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
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`
|
||||
assert.deepEqual(index.fields, ['favorite-color']);
|
||||
assert.deepEqual(index.fields, ["favorite-color"]);
|
||||
|
||||
// -- 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`
|
||||
assert.deepEqual(index.fields, ['favorite-color']);
|
||||
assert.deepEqual(index.fields, ["favorite-color"]);
|
||||
```
|
||||
|
||||
## collection.createGeoIndex
|
||||
|
@ -110,34 +113,34 @@ Creates a geo-spatial index on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fields**: `Array<string>`
|
||||
- **fields**: `Array<string>`
|
||||
|
||||
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
|
||||
wrapped in an array automatically.
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
An object containing additional properties of the index.
|
||||
|
||||
For more information on the properties of the _opts_ object see
|
||||
[the HTTP API for manipulating geo indexes](../../../..//HTTP/Indexes/Geo.html).
|
||||
For more information on the properties of the _opts_ object see the
|
||||
[HTTP API for manipulating geo indexes](../../../..//HTTP/Indexes/Geo.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
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`
|
||||
assert.deepEqual(index.fields, ['longitude', 'latitude']);
|
||||
assert.deepEqual(index.fields, ["longitude", "latitude"]);
|
||||
|
||||
// -- 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`
|
||||
assert.deepEqual(index.fields, ['location']);
|
||||
assert.deepEqual(index.fields, ["location"]);
|
||||
```
|
||||
|
||||
## collection.createFulltextIndex
|
||||
|
@ -148,13 +151,13 @@ Creates a fulltext index on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fields**: `Array<string>`
|
||||
- **fields**: `Array<string>`
|
||||
|
||||
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
|
||||
will be wrapped in an array automatically.
|
||||
|
||||
* **minLength** (optional):
|
||||
- **minLength** (optional):
|
||||
|
||||
Minimum character length of words to index. Uses a server-specific default
|
||||
value if not specified.
|
||||
|
@ -166,17 +169,17 @@ For more information on fulltext indexes, see
|
|||
|
||||
```js
|
||||
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`
|
||||
assert.deepEqual(index.fields, ['description']);
|
||||
assert.deepEqual(index.fields, ["description"]);
|
||||
|
||||
// -- or --
|
||||
|
||||
const index = await collection.createFulltextIndex(['description']);
|
||||
const index = await collection.createFulltextIndex(["description"]);
|
||||
// the index has been created with the handle `index.id`
|
||||
assert.deepEqual(index.fields, ['description']);
|
||||
assert.deepEqual(index.fields, ["description"]);
|
||||
```
|
||||
|
||||
## collection.createPersistentIndex
|
||||
|
@ -190,11 +193,11 @@ being that it will always be orders of magnitude slower than in-memory indexes.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fields**: `Array<string>`
|
||||
- **fields**: `Array<string>`
|
||||
|
||||
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.
|
||||
|
||||
|
@ -205,11 +208,11 @@ For more information on the properties of the _opts_ object see
|
|||
|
||||
```js
|
||||
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`
|
||||
assert.deepEqual(index.fields, ['name', 'email']);
|
||||
assert.deepEqual(index.fields, ["name", "email"]);
|
||||
```
|
||||
|
||||
## collection.index
|
||||
|
@ -220,7 +223,7 @@ Fetches information about the index with the given _indexHandle_ and returns it.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **indexHandle**: `string`
|
||||
- **indexHandle**: `string`
|
||||
|
||||
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
|
||||
|
@ -230,15 +233,15 @@ Fetches information about the index with the given _indexHandle_ and returns it.
|
|||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const index = await collection.createFulltextIndex('description');
|
||||
const collection = db.collection("some-collection");
|
||||
const index = await collection.createFulltextIndex("description");
|
||||
const result = await collection.index(index.id);
|
||||
assert.equal(result.id, index.id);
|
||||
// result contains the properties of the index
|
||||
|
||||
// -- 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);
|
||||
// result contains the properties of the index
|
||||
```
|
||||
|
@ -253,8 +256,8 @@ Fetches a list of all indexes on this collection.
|
|||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
await collection.createFulltextIndex('description')
|
||||
const collection = db.collection("some-collection");
|
||||
await collection.createFulltextIndex("description");
|
||||
const indexes = await collection.indexes();
|
||||
assert.equal(indexes.length, 1);
|
||||
// indexes contains information about the index
|
||||
|
@ -268,7 +271,7 @@ Deletes the index with the given _indexHandle_ from the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **indexHandle**: `string`
|
||||
- **indexHandle**: `string`
|
||||
|
||||
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
|
||||
|
@ -278,14 +281,14 @@ Deletes the index with the given _indexHandle_ from the collection.
|
|||
|
||||
```js
|
||||
const db = new Database();
|
||||
const collection = db.collection('some-collection');
|
||||
const index = await collection.createFulltextIndex('description');
|
||||
const collection = db.collection("some-collection");
|
||||
const index = await collection.createFulltextIndex("description");
|
||||
await collection.dropIndex(index.id);
|
||||
// the index has been removed from the collection
|
||||
|
||||
// -- or --
|
||||
|
||||
await collection.dropIndex(index.id.split('/')[1]);
|
||||
await collection.dropIndex(index.id.split("/")[1]);
|
||||
// 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.
|
||||
|
||||
**Note**: This method is not available when using the driver with ArangoDB 3.0
|
||||
and higher as cap constraints are no longer supported.
|
||||
{% hint 'warning' %}
|
||||
This method is not available when targeting ArangoDB 3.0 or later,
|
||||
see [Compatibility](../../GettingStarted/README.md#compatibility).
|
||||
{% endhint %}
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **size**: `Object`
|
||||
- **size**: `Object`
|
||||
|
||||
An object with any of the following properties:
|
||||
|
||||
* **size**: `number` (optional)
|
||||
- **size**: `number` (optional)
|
||||
|
||||
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).
|
||||
|
||||
If _size_ is a number, it will be interpreted as _size.size_.
|
||||
|
||||
For more information on the properties of the _size_ object see
|
||||
[the HTTP API for creating cap constraints](https://docs.arangodb.com/2.8/HttpIndexes/Cap.html).
|
||||
For more information on the properties of the _size_ object see the
|
||||
[HTTP API for creating cap constraints](https://docs.arangodb.com/2.8/HttpIndexes/Cap.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
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`
|
||||
assert.equal(index.size, 20);
|
||||
|
||||
// -- 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`
|
||||
assert.equal(index.size, 20);
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
See
|
||||
[the HTTP API documentation](../../../..//HTTP/Collection/Getting.html)
|
||||
See the
|
||||
[HTTP API documentation](../../../..//HTTP/Collection/Getting.html)
|
||||
for details.
|
||||
|
||||
## collection.exists
|
||||
|
@ -117,8 +117,8 @@ Retrieves the collection checksum.
|
|||
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for getting collection information](../../../..//HTTP/Collection/Getting.html).
|
||||
For information on the possible options see the
|
||||
[HTTP API for getting collection information](../../../..//HTTP/Collection/Getting.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -13,10 +13,10 @@ Performs a query to fetch all documents in the collection. Returns a
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for returning all documents](../../../..//HTTP/SimpleQuery/index.html#return-all-documents).
|
||||
For information on the possible options see the
|
||||
[HTTP API for returning all documents](../../../..//HTTP/SimpleQuery/index.html#return-all-documents).
|
||||
|
||||
## 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
|
||||
array of the matching documents.
|
||||
|
||||
**Note**: This method is not available when using the driver with ArangoDB 3.0
|
||||
and higher as the corresponding API method has been removed.
|
||||
{% hint 'warning' %}
|
||||
This method is not available when targeting ArangoDB 3.0 or later,
|
||||
see [Compatibility](../../GettingStarted/README.md#compatibility).
|
||||
{% endhint %}
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for returning the first document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#first-document-of-a-collection).
|
||||
For information on the possible options see the
|
||||
[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_.
|
||||
|
||||
|
@ -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
|
||||
of the matching documents.
|
||||
|
||||
**Note**: This method is not available when using the driver with ArangoDB 3.0
|
||||
and higher as the corresponding API method has been removed.
|
||||
{% hint 'warning' %}
|
||||
This method is not available when targeting ArangoDB 3.0 or later,
|
||||
see [Compatibility](../../GettingStarted/README.md#compatibility).
|
||||
{% endhint %}
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **opts**: `Object` (optional)
|
||||
- **opts**: `Object` (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for returning the last document of a collection](https://docs.arangodb.com/2.8/HttpSimpleQuery/#last-document-of-a-collection).
|
||||
For information on the possible options see the
|
||||
[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_.
|
||||
|
||||
|
@ -71,14 +75,14 @@ _example_. Returns a [new _Cursor_ instance](../Cursor.md) for the query results
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **example**: _Object_
|
||||
- **example**: _Object_
|
||||
|
||||
An object representing an example for documents to be matched against.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for fetching documents by example](../../../..//HTTP/SimpleQuery/index.html#find-documents-matching-an-example).
|
||||
For information on the possible options see the
|
||||
[HTTP API for fetching documents by example](../../../..//HTTP/SimpleQuery/index.html#find-documents-matching-an-example).
|
||||
|
||||
## collection.firstExample
|
||||
|
||||
|
@ -88,7 +92,7 @@ Fetches the first document in the collection matching the given _example_.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **example**: _Object_
|
||||
- **example**: _Object_
|
||||
|
||||
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**
|
||||
|
||||
* **example**: _Object_
|
||||
- **example**: _Object_
|
||||
|
||||
An object representing an example for documents to be matched against.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for removing documents by example](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-example).
|
||||
For information on the possible options see the
|
||||
[HTTP API for removing documents by example](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-example).
|
||||
|
||||
## collection.replaceByExample
|
||||
|
||||
|
@ -118,18 +122,18 @@ given _newValue_.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **example**: _Object_
|
||||
- **example**: _Object_
|
||||
|
||||
An object representing an example for documents to be matched against.
|
||||
|
||||
* **newValue**: _Object_
|
||||
- **newValue**: _Object_
|
||||
|
||||
The new value to replace matching documents with.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for replacing documents by example](../../../..//HTTP/SimpleQuery/index.html#replace-documents-by-example).
|
||||
For information on the possible options see the
|
||||
[HTTP API for replacing documents by example](../../../..//HTTP/SimpleQuery/index.html#replace-documents-by-example).
|
||||
|
||||
## collection.updateByExample
|
||||
|
||||
|
@ -140,18 +144,18 @@ with the given _newValue_.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **example**: _Object_
|
||||
- **example**: _Object_
|
||||
|
||||
An object representing an example for documents to be matched against.
|
||||
|
||||
* **newValue**: _Object_
|
||||
- **newValue**: _Object_
|
||||
|
||||
The new value to update matching documents with.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for updating documents by example](../../../..//HTTP/SimpleQuery/index.html#update-documents-by-example).
|
||||
For information on the possible options see the
|
||||
[HTTP API for updating documents by example](../../../..//HTTP/SimpleQuery/index.html#update-documents-by-example).
|
||||
|
||||
## collection.lookupByKeys
|
||||
|
||||
|
@ -162,7 +166,7 @@ array of the matching documents.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **keys**: _Array_
|
||||
- **keys**: _Array_
|
||||
|
||||
An array of document keys to look up.
|
||||
|
||||
|
@ -174,14 +178,14 @@ Deletes the documents with the given _keys_ from the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **keys**: _Array_
|
||||
- **keys**: _Array_
|
||||
|
||||
An array of document keys to delete.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for removing documents by keys](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-their-keys).
|
||||
For information on the possible options see the
|
||||
[HTTP API for removing documents by keys](../../../..//HTTP/SimpleQuery/index.html#remove-documents-by-their-keys).
|
||||
|
||||
## collection.fulltext
|
||||
|
||||
|
@ -191,15 +195,15 @@ Performs a fulltext query in the given _fieldName_ on the collection.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **fieldName**: _String_
|
||||
- **fieldName**: _String_
|
||||
|
||||
Name of the field to search on documents in the collection.
|
||||
|
||||
* **query**: _String_
|
||||
- **query**: _String_
|
||||
|
||||
Fulltext query string to search for.
|
||||
|
||||
* **opts**: _Object_ (optional)
|
||||
- **opts**: _Object_ (optional)
|
||||
|
||||
For information on the possible options see
|
||||
[the HTTP API for fulltext queries](../../../..//HTTP/Indexes/Fulltext.html).
|
||||
For information on the possible options see the
|
||||
[HTTP API for fulltext queries](../../../..//HTTP/Indexes/Fulltext.html).
|
||||
|
|
|
@ -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_ 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
|
||||
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.
|
||||
|
||||
Equivalent to _Array.prototype.some_ (except async).
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
[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
|
||||
|
||||
`async database.createDatabase(databaseName, [users]): Object`
|
||||
|
@ -163,7 +40,7 @@ Creates a new database with the given _databaseName_.
|
|||
|
||||
```js
|
||||
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
|
||||
```
|
||||
|
||||
|
@ -232,7 +109,7 @@ Deletes the database with the given _databaseName_ from the server.
|
|||
|
||||
```js
|
||||
const db = new Database();
|
||||
await db.dropDatabase('mydb');
|
||||
await db.dropDatabase("mydb");
|
||||
// database "mydb" no longer exists
|
||||
```
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
## database.listServices
|
||||
|
@ -9,7 +9,7 @@ Fetches a list of all installed service.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **excludeSystem**: `boolean` (Default: `true`)
|
||||
- **excludeSystem**: `boolean` (Default: `true`)
|
||||
|
||||
Whether system services should be excluded.
|
||||
|
||||
|
@ -31,56 +31,56 @@ Installs a new service.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **source**: `Buffer | Readable | File | string`
|
||||
- **source**: `Buffer | Readable | File | string`
|
||||
|
||||
The service bundle to install.
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
An object with any of the following properties:
|
||||
|
||||
* **configuration**: `Object` (optional)
|
||||
- **configuration**: `Object` (optional)
|
||||
|
||||
An object mapping configuration option names to values.
|
||||
|
||||
* **dependencies**: `Object` (optional)
|
||||
- **dependencies**: `Object` (optional)
|
||||
|
||||
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.
|
||||
|
||||
* **legacy**: `boolean` (Default: `false`)
|
||||
- **legacy**: `boolean` (Default: `false`)
|
||||
|
||||
Whether the service should be installed in legacy compatibility mode.
|
||||
|
||||
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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const source = fs.createReadStream('./my-foxx-service.zip');
|
||||
const info = await db.installService('/hello', source);
|
||||
const source = fs.createReadStream("./my-foxx-service.zip");
|
||||
const info = await db.installService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const source = fs.readFileSync('./my-foxx-service.zip');
|
||||
const info = await db.installService('/hello', source);
|
||||
const source = fs.readFileSync("./my-foxx-service.zip");
|
||||
const info = await db.installService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const element = document.getElementById('my-file-input');
|
||||
const element = document.getElementById("my-file-input");
|
||||
const source = element.files[0];
|
||||
const info = await db.installService('/hello', source);
|
||||
const info = await db.installService("/hello", source);
|
||||
```
|
||||
|
||||
## database.replaceService
|
||||
|
@ -92,64 +92,64 @@ service and installing a new service at the same mount point.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
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.
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
An object with any of the following properties:
|
||||
|
||||
* **configuration**: `Object` (optional)
|
||||
- **configuration**: `Object` (optional)
|
||||
|
||||
An object mapping configuration option names to values.
|
||||
|
||||
This configuration will replace the existing configuration.
|
||||
|
||||
* **dependencies**: `Object` (optional)
|
||||
- **dependencies**: `Object` (optional)
|
||||
|
||||
An object mapping dependency aliases to mount points.
|
||||
|
||||
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.
|
||||
|
||||
* **legacy**: `boolean` (Default: `false`)
|
||||
- **legacy**: `boolean` (Default: `false`)
|
||||
|
||||
Whether the new service should be installed in legacy compatibility mode.
|
||||
|
||||
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.
|
||||
|
||||
* **setup**: `boolean` (Default: `true`)
|
||||
- **setup**: `boolean` (Default: `true`)
|
||||
|
||||
Whether the setup script of the new service should be executed.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const source = fs.createReadStream('./my-foxx-service.zip');
|
||||
const info = await db.replaceService('/hello', source);
|
||||
const source = fs.createReadStream("./my-foxx-service.zip");
|
||||
const info = await db.replaceService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const source = fs.readFileSync('./my-foxx-service.zip');
|
||||
const info = await db.replaceService('/hello', source);
|
||||
const source = fs.readFileSync("./my-foxx-service.zip");
|
||||
const info = await db.replaceService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const element = document.getElementById('my-file-input');
|
||||
const element = document.getElementById("my-file-input");
|
||||
const source = element.files[0];
|
||||
const info = await db.replaceService('/hello', source);
|
||||
const info = await db.replaceService("/hello", source);
|
||||
```
|
||||
|
||||
## database.upgradeService
|
||||
|
@ -161,64 +161,64 @@ service's configuration and dependencies.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
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.
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
An object with any of the following properties:
|
||||
|
||||
* **configuration**: `Object` (optional)
|
||||
- **configuration**: `Object` (optional)
|
||||
|
||||
An object mapping configuration option names to values.
|
||||
|
||||
This configuration will be merged into the existing configuration.
|
||||
|
||||
* **dependencies**: `Object` (optional)
|
||||
- **dependencies**: `Object` (optional)
|
||||
|
||||
An object mapping dependency aliases to mount points.
|
||||
|
||||
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.
|
||||
|
||||
* **legacy**: `boolean` (Default: `false`)
|
||||
- **legacy**: `boolean` (Default: `false`)
|
||||
|
||||
Whether the new service should be installed in legacy compatibility mode.
|
||||
|
||||
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.
|
||||
|
||||
* **setup**: `boolean` (Default: `true`)
|
||||
- **setup**: `boolean` (Default: `true`)
|
||||
|
||||
Whether the setup script of the new service should be executed.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const source = fs.createReadStream('./my-foxx-service.zip');
|
||||
const info = await db.upgradeService('/hello', source);
|
||||
const source = fs.createReadStream("./my-foxx-service.zip");
|
||||
const info = await db.upgradeService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const source = fs.readFileSync('./my-foxx-service.zip');
|
||||
const info = await db.upgradeService('/hello', source);
|
||||
const source = fs.readFileSync("./my-foxx-service.zip");
|
||||
const info = await db.upgradeService("/hello", source);
|
||||
|
||||
// -- or --
|
||||
|
||||
const element = document.getElementById('my-file-input');
|
||||
const element = document.getElementById("my-file-input");
|
||||
const source = element.files[0];
|
||||
const info = await db.upgradeService('/hello', source);
|
||||
const info = await db.upgradeService("/hello", source);
|
||||
```
|
||||
|
||||
## database.uninstallService
|
||||
|
@ -229,22 +229,22 @@ Completely removes a service from the database.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
An object with any of the following properties:
|
||||
|
||||
* **teardown**: `boolean` (Default: `true`)
|
||||
- **teardown**: `boolean` (Default: `true`)
|
||||
|
||||
Whether the teardown script should be executed.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
await db.uninstallService('/my-service');
|
||||
await db.uninstallService("/my-service");
|
||||
// service was uninstalled
|
||||
```
|
||||
|
||||
|
@ -256,14 +256,14 @@ Retrieves information about a mounted service.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const info = await db.getService('/my-service');
|
||||
const info = await db.getService("/my-service");
|
||||
// info contains detailed information about the service
|
||||
```
|
||||
|
||||
|
@ -276,39 +276,38 @@ and their current values.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **minimal**: `boolean` (Default: `false`)
|
||||
- **minimal**: `boolean` (Default: `false`)
|
||||
|
||||
Only return the current values.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const config = await db.getServiceConfiguration('/my-service');
|
||||
const config = await db.getServiceConfiguration("/my-service");
|
||||
// config contains information about the service's configuration
|
||||
```
|
||||
|
||||
## database.replaceServiceConfiguration
|
||||
|
||||
`async database.replaceServiceConfiguration(mount, configuration, [minimal]):
|
||||
Object`
|
||||
`async database.replaceServiceConfiguration(mount, configuration, [minimal]): Object`
|
||||
|
||||
Replaces the configuration of the given service.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **configuration**: `Object`
|
||||
- **configuration**: `Object`
|
||||
|
||||
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).
|
||||
|
||||
|
@ -318,31 +317,30 @@ Replaces the configuration of the given service.
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
const config = {currency: 'USD', locale: 'en-US'};
|
||||
const info = await db.replaceServiceConfiguration('/my-service', config);
|
||||
const config = { currency: "USD", locale: "en-US" };
|
||||
const info = await db.replaceServiceConfiguration("/my-service", config);
|
||||
// info.values contains information about the service's configuration
|
||||
// info.warnings contains any validation errors for the configuration
|
||||
```
|
||||
|
||||
## database.updateServiceConfiguration
|
||||
|
||||
`async database.updateServiceConfiguration(mount, configuration, [minimal]):
|
||||
Object`
|
||||
`async database.updateServiceConfiguration(mount, configuration, [minimal]): Object`
|
||||
|
||||
Updates the configuration of the given service my merging the new values into
|
||||
the existing ones.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **configuration**: `Object`
|
||||
- **configuration**: `Object`
|
||||
|
||||
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).
|
||||
|
||||
|
@ -352,8 +350,8 @@ the existing ones.
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
const config = {locale: 'en-US'};
|
||||
const info = await db.updateServiceConfiguration('/my-service', config);
|
||||
const config = { locale: "en-US" };
|
||||
const info = await db.updateServiceConfiguration("/my-service", config);
|
||||
// info.values contains information about the service's configuration
|
||||
// info.warnings contains any validation errors for the configuration
|
||||
```
|
||||
|
@ -367,39 +365,38 @@ current mount points.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
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).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const deps = await db.getServiceDependencies('/my-service');
|
||||
const deps = await db.getServiceDependencies("/my-service");
|
||||
// deps contains information about the service's dependencies
|
||||
```
|
||||
|
||||
## database.replaceServiceDependencies
|
||||
|
||||
`async database.replaceServiceDependencies(mount, dependencies, [minimal]):
|
||||
Object`
|
||||
`async database.replaceServiceDependencies(mount, dependencies, [minimal]): Object`
|
||||
|
||||
Replaces the dependencies for the given service.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **dependencies**: `Object`
|
||||
- **dependencies**: `Object`
|
||||
|
||||
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).
|
||||
|
||||
|
@ -409,31 +406,30 @@ Replaces the dependencies for the given service.
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
const deps = {mailer: '/mailer-api', auth: '/remote-auth'};
|
||||
const info = await db.replaceServiceDependencies('/my-service', deps);
|
||||
const deps = { mailer: "/mailer-api", auth: "/remote-auth" };
|
||||
const info = await db.replaceServiceDependencies("/my-service", deps);
|
||||
// info.values contains information about the service's dependencies
|
||||
// info.warnings contains any validation errors for the dependencies
|
||||
```
|
||||
|
||||
## database.updateServiceDependencies
|
||||
|
||||
`async database.updateServiceDependencies(mount, dependencies, [minimal]):
|
||||
Object`
|
||||
`async database.updateServiceDependencies(mount, dependencies, [minimal]): Object`
|
||||
|
||||
Updates the dependencies for the given service by merging the new values into
|
||||
the existing ones.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **dependencies**: `Object`
|
||||
- **dependencies**: `Object`
|
||||
|
||||
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).
|
||||
|
||||
|
@ -443,8 +439,8 @@ the existing ones.
|
|||
**Examples**
|
||||
|
||||
```js
|
||||
const deps = {mailer: '/mailer-api'};
|
||||
const info = await db.updateServiceDependencies('/my-service', deps);
|
||||
const deps = { mailer: "/mailer-api" };
|
||||
const info = await db.updateServiceDependencies("/my-service", deps);
|
||||
// info.values contains information about the service's dependencies
|
||||
// info.warnings contains any validation errors for the dependencies
|
||||
```
|
||||
|
@ -457,14 +453,14 @@ Enables development mode for the given service.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const info = await db.enableServiceDevelopmentMode('/my-service');
|
||||
const info = await db.enableServiceDevelopmentMode("/my-service");
|
||||
// the service is now in development mode
|
||||
// info contains detailed information about the service
|
||||
```
|
||||
|
@ -478,14 +474,14 @@ the database.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const info = await db.disableServiceDevelopmentMode('/my-service');
|
||||
const info = await db.disableServiceDevelopmentMode("/my-service");
|
||||
// the service is now in production mode
|
||||
// info contains detailed information about the service
|
||||
```
|
||||
|
@ -500,14 +496,14 @@ Returns an object mapping each name to a more readable representation.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const scripts = await db.listServiceScripts('/my-service');
|
||||
const scripts = await db.listServiceScripts("/my-service");
|
||||
// scripts is an object listing the service scripts
|
||||
```
|
||||
|
||||
|
@ -519,22 +515,22 @@ Runs a service script and returns the result.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
* **name**: `string`
|
||||
- **name**: `string`
|
||||
|
||||
Name of the script to execute.
|
||||
|
||||
* **scriptArg**: `any`
|
||||
- **scriptArg**: `any`
|
||||
|
||||
Value that will be passed as an argument to the script.
|
||||
|
||||
**Examples**
|
||||
|
||||
```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)
|
||||
```
|
||||
|
||||
|
@ -546,40 +542,40 @@ Runs the tests of a given service and returns a formatted report.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
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.
|
||||
|
||||
As of ArangoDB 3.2 the following reporters are supported:
|
||||
|
||||
* **stream**: an array of event objects
|
||||
* **suite**: nested suite objects with test results
|
||||
* **xunit**: JSONML representation of an XUnit report
|
||||
* **tap**: an array of TAP event strings
|
||||
* **default**: an array of test results
|
||||
- **stream**: an array of event objects
|
||||
- **suite**: nested suite objects with test results
|
||||
- **xunit**: JSONML representation of an XUnit report
|
||||
- **tap**: an array of TAP event strings
|
||||
- **default**: an array of test results
|
||||
|
||||
* **idiomatic**: `boolean` (Default: `false`)
|
||||
- **idiomatic**: `boolean` (Default: `false`)
|
||||
|
||||
Whether the results should be converted to the apropriate `string`
|
||||
representation:
|
||||
|
||||
* **xunit** reports will be formatted as XML documents
|
||||
* **tap** reports will be formatted as TAP streams
|
||||
* **stream** reports will be formatted as JSON-LD streams
|
||||
- **xunit** reports will be formatted as XML documents
|
||||
- **tap** reports will be formatted as TAP streams
|
||||
- **stream** reports will be formatted as JSON-LD streams
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const opts = {reporter: 'xunit', idiomatic: true};
|
||||
const result = await db.runServiceTests('/my-service', opts);
|
||||
const opts = { reporter: "xunit", idiomatic: true };
|
||||
const result = await db.runServiceTests("/my-service", opts);
|
||||
// result contains the XUnit report as a string
|
||||
```
|
||||
|
||||
|
@ -593,14 +589,14 @@ Returns a `Buffer` in Node or `Blob` in the browser version.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const bundle = await db.downloadService('/my-service');
|
||||
const bundle = await db.downloadService("/my-service");
|
||||
// bundle is a Buffer/Blob of the service bundle
|
||||
```
|
||||
|
||||
|
@ -614,14 +610,14 @@ Returns `undefined` if no such file could be found.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const readme = await db.getServiceReadme('/my-service');
|
||||
const readme = await db.getServiceReadme("/my-service");
|
||||
// readme is a string containing the service README's
|
||||
// text content, or undefined if no README exists
|
||||
```
|
||||
|
@ -635,14 +631,14 @@ given mount point.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **mount**: `string`
|
||||
- **mount**: `string`
|
||||
|
||||
The service's mount point, relative to the database.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const spec = await db.getServiceDocumentation('/my-service');
|
||||
const spec = await db.getServiceDocumentation("/my-service");
|
||||
// spec is a Swagger API description of the service
|
||||
```
|
||||
|
||||
|
@ -655,7 +651,7 @@ bundles missing in the database.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **replace**: `boolean` (Default: `false`)
|
||||
- **replace**: `boolean` (Default: `false`)
|
||||
|
||||
Also commit outdated services.
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
## database.route
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
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
|
||||
used as the values of the respective arguments instead.
|
||||
|
|
|
@ -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
|
||||
|
||||
## 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.
|
||||
|
||||
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
|
||||
any point.
|
||||
|
||||
**Note**: As of arangojs 6.0.0 it is no longer possible to pass
|
||||
the username or password from the URL.
|
||||
{% hint 'warning' %}
|
||||
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
|
||||
_useBasicAuth_ or _useBearerAuth_ methods.
|
||||
|
@ -51,17 +54,13 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
|
||||
- **arangoVersion**: `number` (Default: `30000`)
|
||||
|
||||
Value of the `x-arango-version` header. This should match the lowest
|
||||
version of ArangoDB you expect to be using. The format is defined as
|
||||
`XYYZZ` where `X` is the major version, `Y` is the two-digit minor version
|
||||
and `Z` is the two-digit bugfix version.
|
||||
Numeric representation of the ArangoDB version the driver should expect.
|
||||
The format is defined as `XYYZZ` where `X` is the major version, `Y` is
|
||||
the zero-filled two-digit minor version and `Z` is the zero-filled two-digit
|
||||
bugfix version, e.g. `30102` for 3.1.2, `20811` for 2.8.11.
|
||||
|
||||
**Example**: `30102` corresponds to version 3.1.2 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_).
|
||||
Depending on this value certain methods may become unavailable or change
|
||||
their behavior to remain compatible with different versions of ArangoDB.
|
||||
|
||||
- **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)
|
||||
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(): void`
|
||||
|
|
|
@ -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
|
||||
|
||||
This function implements the
|
||||
|
@ -6,62 +6,65 @@ This function implements the
|
|||
|
||||
## database.transaction
|
||||
|
||||
`async database.transaction(collections, action, [params, [options]]):
|
||||
Object`
|
||||
`async database.transaction(collections, action, [params, [options]]): Object`
|
||||
|
||||
Performs a server-side transaction and returns its return value.
|
||||
|
||||
**Arguments**
|
||||
|
||||
* **collections**: `Object`
|
||||
- **collections**: `Object`
|
||||
|
||||
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
|
||||
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
|
||||
or read from during the transaction.
|
||||
|
||||
* **action**: `string`
|
||||
- **action**: `string`
|
||||
|
||||
A string evaluating to a JavaScript function to be executed on the server.
|
||||
|
||||
**Note**: For accessing the database from within ArangoDB, see
|
||||
[the documentation for the `@arangodb` module in ArangoDB](../../../..//Manual/Appendix/JavaScriptModules/ArangoDB.html).
|
||||
{% hint 'warning ' %}
|
||||
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
|
||||
server. Check the example below.
|
||||
|
||||
* **options**: `Object` (optional)
|
||||
- **options**: `Object` (optional)
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
* **maxTransactionSize**: `number` (optional)
|
||||
- **maxTransactionSize**: `number` (optional)
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
in plain text.
|
||||
|
||||
For more information on transactions, see
|
||||
[the HTTP API documentation for transactions](../../../..//HTTP/Transaction/index.html).
|
||||
For more information on transactions, see the
|
||||
[HTTP API documentation for transactions](../../../..//HTTP/Transaction/index.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const action = String(function (params) {
|
||||
const action = String(function(params) {
|
||||
// This code will be executed inside ArangoDB!
|
||||
const db = require('@arangodb').db;
|
||||
return db._query(aql`
|
||||
const db = require("@arangodb").db;
|
||||
return db
|
||||
._query(
|
||||
aql`
|
||||
FOR user IN _users
|
||||
FILTER user.age > ${params.age}
|
||||
RETURN u.user
|
||||
`).toArray();
|
||||
`
|
||||
)
|
||||
.toArray();
|
||||
});
|
||||
|
||||
const result = await db.transaction(
|
||||
{read: '_users'},
|
||||
action,
|
||||
{age: 12}
|
||||
);
|
||||
const result = await db.transaction({ read: "_users" }, action, { age: 12 });
|
||||
// result contains the return value of the action
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -8,13 +8,18 @@ These functions implement the
|
|||
|
||||
`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.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **viewName**: `string`
|
||||
|
||||
Name of the `arangosearch` view.
|
||||
Name of the arangosearch view.
|
||||
|
||||
**Examples**
|
||||
|
||||
|
@ -27,6 +32,11 @@ const view = db.arangoSearchView("potatoes");
|
|||
|
||||
`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
|
||||
descriptions.
|
||||
|
||||
|
@ -43,6 +53,11 @@ const views = await db.listViews();
|
|||
|
||||
`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
|
||||
_ArangoSearchView_ instances for the views.
|
||||
|
||||
|
@ -51,6 +66,6 @@ _ArangoSearchView_ instances for the views.
|
|||
```js
|
||||
const db = new Database();
|
||||
|
||||
const views = await db.views()
|
||||
const views = await db.views();
|
||||
// views is an array of ArangoSearchView instances
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
The _GraphEdgeCollection API_ extends the
|
||||
|
|
|
@ -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
|
||||
|
||||
## graph.edgeCollection
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
The _GraphVertexCollection API_ extends the
|
||||
|
|
|
@ -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
|
||||
|
||||
## graph.vertexCollection
|
||||
|
|
|
@ -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
|
||||
|
||||
- [Database](Database/README.md)
|
||||
|
|
|
@ -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_ instances provide access for arbitrary HTTP requests. This allows easy
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -8,13 +8,18 @@ These functions implement the
|
|||
|
||||
`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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const result = await view.exists();
|
||||
// result indicates whether the view exists
|
||||
```
|
||||
|
@ -23,13 +28,18 @@ const result = await view.exists();
|
|||
|
||||
`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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const data = await view.get();
|
||||
// data contains general information about the view
|
||||
```
|
||||
|
@ -38,13 +48,18 @@ const data = await view.get();
|
|||
|
||||
`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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const data = await view.properties();
|
||||
// data contains the view's properties
|
||||
```
|
||||
|
@ -53,6 +68,11 @@ const data = await view.properties();
|
|||
|
||||
`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,
|
||||
then returns the server response.
|
||||
|
||||
|
@ -60,15 +80,15 @@ then returns the server response.
|
|||
|
||||
- **properties**: `Object` (optional)
|
||||
|
||||
For more information on the _properties_ object, see
|
||||
[the HTTP API documentation for creating views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
For more information on the _properties_ object, see the
|
||||
[HTTP API documentation for creating views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('potatoes');
|
||||
await view.create()
|
||||
const view = db.arangoSearchView("potatoes");
|
||||
await view.create();
|
||||
// the arangosearch view "potatoes" now exists
|
||||
```
|
||||
|
||||
|
@ -76,50 +96,65 @@ await view.create()
|
|||
|
||||
`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.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **properties**: `Object`
|
||||
|
||||
For information on the _properties_ argument see
|
||||
[the HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
For information on the _properties_ argument see the
|
||||
[HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const result = await view.setProperties({ locale: "C" })
|
||||
assert.equal(result.locale, "C");
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const result = await view.setProperties({ consolidationIntervalMsec: 123 });
|
||||
assert.equal(result.consolidationIntervalMsec, 123);
|
||||
```
|
||||
|
||||
## view.replaceProperties
|
||||
|
||||
`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.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **properties**: `Object`
|
||||
|
||||
For information on the _properties_ argument see
|
||||
[the HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
For information on the _properties_ argument see the
|
||||
[HTTP API for modifying views](../../..//HTTP/Views/ArangoSearch.html).
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const result = await view.replaceProperties({ locale: "C" })
|
||||
assert.equal(result.locale, "C");
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const result = await view.replaceProperties({ consolidationIntervalMsec: 234 });
|
||||
assert.equal(result.consolidationIntervalMsec, 234);
|
||||
```
|
||||
|
||||
## view.rename
|
||||
|
||||
`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
|
||||
name when the rename succeeds.
|
||||
|
||||
|
@ -127,9 +162,9 @@ name when the rename succeeds.
|
|||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const result = await view.rename('new-view-name')
|
||||
assert.equal(result.name, 'new-view-name');
|
||||
const view = db.arangoSearchView("some-view");
|
||||
const result = await view.rename("new-view-name");
|
||||
assert.equal(result.name, "new-view-name");
|
||||
assert.equal(view.name, result.name);
|
||||
// result contains additional information about the view
|
||||
```
|
||||
|
@ -138,13 +173,18 @@ assert.equal(view.name, result.name);
|
|||
|
||||
`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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const view = db.arangoSearchView('some-view');
|
||||
const view = db.arangoSearchView("some-view");
|
||||
await view.drop();
|
||||
// the view "some-view" no longer exists
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
## Supported versions
|
||||
|
||||
<table>
|
||||
<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.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>
|
||||
|
@ -26,7 +27,7 @@ ArangoDB 3.x.x
|
|||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>arangodb-java-driver</artifactId>
|
||||
<version>4.6.0</version>
|
||||
<version>5.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
The official ArangoDB Java Driver.
|
||||
|
|
|
@ -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
|
||||
|
||||
This function implements the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement
|
||||
|
@ -73,8 +73,8 @@ Creates a collection with the given _options_ for this collection's name, then r
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
db.createCollection("potatoes", new CollectionCreateOptions());
|
||||
// the document collection "potatoes" now exists
|
||||
db.createCollection("potatos", new CollectionCreateOptions());
|
||||
// the document collection "potatos" now exists
|
||||
```
|
||||
|
||||
## ArangoCollection.create
|
||||
|
@ -144,9 +144,9 @@ Alternative for [ArangoDatabase.createCollection](#arangodatabasecreatecollectio
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
collection.create(new CollectionCreateOptions());
|
||||
// the document collection "potatoes" now exists
|
||||
// the document collection "potatos" now exists
|
||||
```
|
||||
|
||||
## ArangoCollection.load
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -26,7 +26,7 @@ Checks whether the collection exists
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
|
||||
boolean exists = collection.exists();
|
||||
```
|
||||
|
@ -44,7 +44,7 @@ Returns information about the collection.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
|
||||
CollectionEntity info = collection.getInfo();
|
||||
```
|
||||
|
@ -62,7 +62,7 @@ Reads the properties of the specified collection.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
|
||||
CollectionPropertiesEntity properties = collection.getProperties();
|
||||
```
|
||||
|
@ -80,7 +80,7 @@ Retrieve the collections revision.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
|
||||
CollectionRevisionEntity revision = collection.getRevision();
|
||||
```
|
||||
|
@ -98,7 +98,7 @@ Fetches a list of all indexes on this collection.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoCollection collection = db.collection("potatoes");
|
||||
ArangoCollection collection = db.collection("potatos");
|
||||
|
||||
Collection<IndexEntity> indexes = collection.getIndexes();
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
_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.
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoDatabase.route
|
||||
|
|
|
@ -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
|
||||
|
||||
This function implements the
|
||||
|
@ -78,7 +78,7 @@ Performs a database query using the given _query_ and _bindVars_, then returns a
|
|||
|
||||
- **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`
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoDB.db
|
||||
|
|
|
@ -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
|
||||
|
||||
This function implements the
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -32,7 +32,7 @@ ArangoView view = db.view("myView");
|
|||
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**
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoGraph.edgeCollection
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoEdgeCollection.getEdge
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoGraph.vertexCollection
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoVertexCollection.getVertex
|
||||
|
|
|
@ -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
|
||||
|
||||
- [Driver Setup](Setup.md)
|
||||
|
|
|
@ -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
|
||||
|
||||
_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.
|
||||
|
|
|
@ -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
|
||||
|
||||
## VelocyPack serialization
|
||||
|
|
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
```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`.
|
||||
|
@ -124,7 +124,7 @@ The second load balancing strategy allows to pick a random host from the configu
|
|||
|
||||
## 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
|
||||
ArangoDB arango = new ArangoDB.Builder().connectionTtl(5 * 60 * 1000).build();
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
[HTTP API for ArangoSearch Views](../../../..//HTTP/Views/ArangoSearch.html).
|
||||
[HTTP API for ArangoSearch views](../../../..//HTTP/Views/ArangoSearch.html).
|
||||
|
||||
## ArangoDatabase.createArangoSearch
|
||||
|
||||
|
@ -10,7 +10,7 @@ These functions implement the
|
|||
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**
|
||||
|
||||
|
@ -20,11 +20,7 @@ Creates a ArangoSearch View with the given _options_, then returns view informat
|
|||
|
||||
- **options**: `ArangoSearchCreateOptions`
|
||||
|
||||
- **locale**: `String`
|
||||
|
||||
The default locale used for queries on analyzed string values (default: C).
|
||||
|
||||
- **commitIntervalMsec**: `Long`
|
||||
- **consolidationIntervalMsec**: `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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
- **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**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
db.createArangoSearch("potatoes", new ArangoSearchPropertiesOptions());
|
||||
// the ArangoSearch View "potatoes" now exists
|
||||
db.createArangoSearch("potatos", new ArangoSearchPropertiesOptions());
|
||||
// the ArangoSearch view "potatos" now exists
|
||||
```
|
||||
|
||||
## ArangoSearch.create
|
||||
|
@ -51,19 +61,15 @@ db.createArangoSearch("potatoes", new ArangoSearchPropertiesOptions());
|
|||
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**
|
||||
|
||||
- **options**: `ArangoSearchCreateOptions`
|
||||
|
||||
- **locale**: `String`
|
||||
|
||||
The default locale used for queries on analyzed string values (default: C).
|
||||
|
||||
- **commitIntervalMsec**: `Long`
|
||||
- **consolidationIntervalMsec**: `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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
- **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**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoSearch view = db.arangoSearch("potatoes");
|
||||
ArangoSearch view = db.arangoSearch("potatos");
|
||||
|
||||
view.create(new ArangoSearchPropertiesOptions());
|
||||
// the ArangoSearch View "potatoes" now exists
|
||||
// the ArangoSearch view "potatos" now exists
|
||||
```
|
||||
|
||||
## ArangoSearch.getProperties
|
||||
|
@ -99,7 +119,7 @@ Reads the properties of the specified view.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoSearch view = db.arangoSearch("potatoes");
|
||||
ArangoSearch view = db.arangoSearch("potatos");
|
||||
|
||||
ArangoSearchPropertiesEntity properties = view.getProperties();
|
||||
```
|
||||
|
@ -116,11 +136,7 @@ Partially changes properties of the view.
|
|||
|
||||
- **options**: `ArangoSearchPropertiesOptions`
|
||||
|
||||
- **locale**: `String`
|
||||
|
||||
The default locale used for queries on analyzed string values (default: C).
|
||||
|
||||
- **commitIntervalMsec**: `Long`
|
||||
- **consolidationIntervalMsec**: `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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
- **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**
|
||||
|
||||
|
@ -158,11 +184,7 @@ Changes properties of the view.
|
|||
|
||||
- **options**: `ArangoSearchPropertiesOptions`
|
||||
|
||||
- **locale**: `String`
|
||||
|
||||
The default locale used for queries on analyzed string values (default: C).
|
||||
|
||||
- **commitIntervalMsec**: `Long`
|
||||
- **consolidationIntervalMsec**: `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.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
- **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**
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
These functions implement the
|
||||
|
@ -23,7 +23,7 @@ Checks whether the view exists
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoView view = db.view("potatoes");
|
||||
ArangoView view = db.view("potatos");
|
||||
|
||||
boolean exists = view.exists();
|
||||
```
|
||||
|
@ -41,7 +41,7 @@ Returns information about the view.
|
|||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
ArangoView view = db.view("potatoes");
|
||||
ArangoView view = db.view("potatos");
|
||||
|
||||
ViewEntity info = view.getInfo();
|
||||
```
|
||||
|
|
|
@ -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
|
||||
|
||||
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();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
db.createView("myView", ViewType.ARANGO_SEARCH);
|
||||
// the view "potatoes" now exists
|
||||
// the view "potatos" now exists
|
||||
```
|
||||
|
||||
## ArangoView.rename
|
||||
|
|
|
@ -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
|
||||
## Description
|
||||
|
||||
|
|
|
@ -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
|
||||
The official ArangoDB PHP Driver.
|
||||
|
||||
|
|
|
@ -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
|
||||
## Setting up the connection options
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
## 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)
|
||||
* [Getting Started](Java/GettingStarted/README.md)
|
||||
* [Reference](Java/Reference/README.md)
|
||||
|
@ -35,7 +35,7 @@
|
|||
* [Edges Manipulation](Java/Reference/Graph/Edges.md)
|
||||
* [Route](Java/Reference/Route.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)
|
||||
* [Getting Started](JS/GettingStarted/README.md)
|
||||
* [Reference](JS/Reference/README.md)
|
||||
|
@ -65,11 +65,11 @@
|
|||
* [VertexCollection](JS/Reference/Graph/VertexCollection.md)
|
||||
* [EdgeCollection](JS/Reference/Graph/EdgeCollection.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)
|
||||
* [Getting Started](PHP/GettingStarted/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)
|
||||
* [Getting Started](GO/GettingStarted/README.md)
|
||||
* [Example Requests](GO/ExampleRequests/README.md)
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
## 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)
|
||||
* [Getting Started](SpringData/GettingStarted/README.md)
|
||||
* [Reference](SpringData/Reference/README.md)
|
||||
|
@ -102,13 +102,14 @@
|
|||
* [Indexes](SpringData/Reference/Mapping/Indexes.md)
|
||||
* [Converter](SpringData/Reference/Mapping/Converter.md)
|
||||
* [Events](SpringData/Reference/Mapping/Events.md)
|
||||
* [Auditing](SpringData/Reference/Mapping/Auditing.md)
|
||||
* [Migration](SpringData/Migration/README.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)
|
||||
|
||||
# https://@github.com/arangodb/arangodb-spark-connector.git;arangodb-spark-connector;docs/Drivers;;/
|
||||
<!-- SYNC: https://@github.com/arangodb/arangodb-spark-connector.git;arangodb-spark-connector;docs/Drivers;;/ -->
|
||||
* [ArangoDB Spark Connector](SparkConnector/README.md)
|
||||
* [Getting Started](SparkConnector/GettingStarted/README.md)
|
||||
* [Reference](SparkConnector/Reference/README.md)
|
||||
* [Java](SparkConnector/Reference/Java.md)
|
||||
* [Scala](SparkConnector/Reference/Scala.md)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
## 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.user | basic authentication user | root |
|
||||
| arangodb.password | basic authentication password | |
|
||||
| arangodb.protocol | network protocol | VST |
|
||||
| arangodb.useSsl | use SSL connection | false |
|
||||
| arangodb.ssl.keyStoreFile | SSL certificate keystore file | |
|
||||
| arangodb.ssl.passPhrase | SSL pass phrase | |
|
||||
|
|
|
@ -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](GettingStarted/README.md)
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoSpark.save
|
||||
|
|
|
@ -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
|
||||
|
||||
- [Scala](Scala.md)
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoSpark.save
|
||||
|
|
|
@ -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
|
||||
|
||||
## Supported versions
|
||||
|
@ -24,7 +24,7 @@ To use Spring Data ArangoDB in your project, your build automation tool needs to
|
|||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>arangodb-spring-data</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
|
||||
# Migrating Spring Data ArangoDB 2.x to 3.0
|
||||
<!-- don't edit here, it's from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
|
||||
# Migrating Spring Data ArangoDB 1.x to 3.0
|
||||
|
||||
see [Migrating 2.x to 3.0](Migrating-2.x-3.0.md)
|
||||
|
|
|
@ -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
|
||||
|
||||
## Annotations @Key
|
||||
|
|
|
@ -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
|
||||
|
||||
- [Migrating 1.x to 3.0](Migrating-1.x-3.0.md)
|
||||
|
|
|
@ -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](GettingStarted/README.md)
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
```
|
|
@ -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
|
||||
|
||||
## Registering a Spring Converter
|
||||
|
|
|
@ -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
|
||||
|
||||
## Annotation @Document
|
||||
|
|
|
@ -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
|
||||
|
||||
## Annotation @Edge
|
||||
|
|
|
@ -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
|
||||
|
||||
Spring Data ArangoDB includes several `ApplicationEvent` events that your application can respond to by registering subclasses of `AbstractArangoEventListener` in the ApplicationContext.
|
||||
|
|
|
@ -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
|
||||
|
||||
## Annotation @\<IndexType\>Indexed
|
||||
|
|
|
@ -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
|
||||
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
|
||||
With the annotation `@Ref` applied on a field the nested object isn’t 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.
|
||||
|
|
|
@ -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
|
||||
|
||||
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).
|
||||
|
|
|
@ -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
|
||||
|
||||
- [Template](Template/README.md)
|
||||
|
@ -22,3 +22,4 @@
|
|||
- [Indexes](Mapping/Indexes.md)
|
||||
- [Converter](Mapping/Converter.md)
|
||||
- [Events](Mapping/Events.md)
|
||||
- [Auditing](Mapping/Auditing.md)
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoRepository.existsById
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoRepository.findAll
|
||||
|
|
|
@ -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
|
||||
|
||||
## Semantic parts
|
||||
|
|
|
@ -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
|
||||
|
||||
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:
|
||||
|
|
|
@ -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
|
||||
|
||||
Queries using [ArangoDB Query Language (AQL)](https://docs.arangodb.com/current/AQL/index.html) can be supplied with the `@Query` annotation on methods.
|
||||
|
|
|
@ -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
|
||||
|
||||
Spring Data ArangoDB supports three kinds of queries:
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoRepository.exists
|
||||
|
|
|
@ -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
|
||||
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoOperations.collection
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoOperations.exists
|
||||
|
|
|
@ -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
|
||||
|
||||
## ArangoOperations.find
|
||||
|
|
|
@ -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
|
||||
|
||||
```
|
||||
|
@ -73,7 +73,7 @@ Performs a database query using the given _query_ and _bindVars_, then returns a
|
|||
|
||||
- **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`
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
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.
|
||||
|
|
|
@ -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
|
||||
|
||||
{% hint 'info' %}
|
||||
|
@ -104,10 +104,20 @@ arangosync stop sync \
|
|||
--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)
|
||||
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
|
||||
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
Loading…
Reference in New Issue