mirror of https://gitee.com/bigwinds/arangodb
Doc - New Driver Book (#4825)
This commit is contained in:
parent
fb84bb6f24
commit
5661492de0
|
@ -3,5 +3,6 @@
|
|||
*/manual.pdf
|
||||
*/node_modules/
|
||||
books
|
||||
repos
|
||||
ppbooks
|
||||
allComments.txt
|
||||
|
|
|
@ -66,6 +66,9 @@ function appendHeader() {
|
|||
' <li>\n' +
|
||||
' <a href="#" data-book="Cookbook">Cookbook</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Drivers">Drivers</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="downloadIcon" title="Download">\n' +
|
||||
' <a href="https://www.arangodb.com/download-arangodb-docs" target="_blank">\n' +
|
||||
' <i class="fa fa-download"></i>\n' +
|
||||
|
@ -117,7 +120,7 @@ function appendHeader() {
|
|||
};
|
||||
addGoogleSrc();
|
||||
|
||||
$(".arangodb-navmenu a:lt(4)").on("click", function(e) {
|
||||
$(".arangodb-navmenu a[data-book]").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
|
|
|
@ -66,6 +66,9 @@ function appendHeader() {
|
|||
' <li class="active-tab">\n' +
|
||||
' <a href="#" data-book="Cookbook">Cookbook</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Drivers">Drivers</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="downloadIcon" title="Download">\n' +
|
||||
' <a href="https://www.arangodb.com/download-arangodb-docs" target="_blank">\n' +
|
||||
' <i class="fa fa-download"></i>\n' +
|
||||
|
@ -117,7 +120,7 @@ function appendHeader() {
|
|||
};
|
||||
addGoogleSrc();
|
||||
|
||||
$(".arangodb-navmenu a:lt(4)").on("click", function(e) {
|
||||
$(".arangodb-navmenu a[data-book]").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
© ArangoDB - the native multi-model NoSQL database
|
|
@ -0,0 +1,252 @@
|
|||
<!-- don't edit here, its 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.
|
||||
|
||||
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
|
||||
[the official Node.js long-term support schedule](https://github.com/nodejs/LTS).
|
||||
|
||||
The included browser build is compatible with Internet Explorer 11 and recent
|
||||
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)
|
||||
to avoid a known memory leak in older versions of the V8 JavaScript engine.
|
||||
|
||||
## Versions
|
||||
|
||||
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
|
||||
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
|
||||
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_
|
||||
changes that require changes in your code to upgrade.
|
||||
|
||||
If you are getting weird errors or functions seem to be missing, make sure you
|
||||
are using the latest version of the driver and following documentation written
|
||||
for a compatible version. If you are following a tutorial written for an older
|
||||
version of arangojs, you can install that version using the `<name>@<version>`
|
||||
syntax:
|
||||
|
||||
```sh
|
||||
# for version 4.x.x
|
||||
yarn add arangojs@4
|
||||
# - or -
|
||||
npm install --save arangojs@4
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
```sh
|
||||
yarn add arangojs
|
||||
# - or -
|
||||
npm install --save arangojs
|
||||
```
|
||||
|
||||
### With Bower
|
||||
|
||||
Starting with arangojs 6.0.0 Bower is no longer supported and the browser
|
||||
build is now included in the NPM release (see below).
|
||||
|
||||
### From source
|
||||
|
||||
```sh
|
||||
git clone https://github.com/arangodb/arangojs.git
|
||||
cd arangojs
|
||||
npm install
|
||||
npm run dist
|
||||
```
|
||||
|
||||
### For browsers
|
||||
|
||||
For production use arangojs can be installed with Yarn or NPM like any
|
||||
other dependency. Just use arangojs like you would in your server code:
|
||||
|
||||
```js
|
||||
import { Database } from "arangojs";
|
||||
// -- or --
|
||||
var arangojs = require("arangojs");
|
||||
```
|
||||
|
||||
Additionally the NPM release comes with a precompiled browser build:
|
||||
|
||||
```js
|
||||
var arangojs = require("arangojs/lib/web");
|
||||
```
|
||||
|
||||
You can also use [unpkg](https://unpkg.com) during development:
|
||||
|
||||
```html
|
||||
< !-- note the path includes the version number (e.g. 6.0.0) -- >
|
||||
<script src="https://unpkg.com/arangojs@6.0.0/lib/web.js"></script>
|
||||
<script>
|
||||
var db = new arangojs.Database();
|
||||
db.listCollections().then(function (collections) {
|
||||
alert("Your collections: " + collections.map(function (collection) {
|
||||
return collection.name;
|
||||
}).join(", "));
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
If you are targetting browsers older than Internet Explorer 11 you
|
||||
may want to use [babel](https://babeljs.io) with a [polyfill](https://babeljs.io/docs/usage/polyfill)
|
||||
to provide missing functionality needed to use arangojs.
|
||||
|
||||
When loading the browser build with a script tag make sure to load the polyfill first:
|
||||
|
||||
```html
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.js"></script>
|
||||
<script src="https://unpkg.com/arangojs@6.0.0/lib/web.js"></script>
|
||||
```
|
||||
|
||||
## Basic usage example
|
||||
|
||||
```js
|
||||
// Modern JavaScript
|
||||
import { Database, aql } from "arangojs";
|
||||
const db = new Database();
|
||||
(async function() {
|
||||
const now = Date.now();
|
||||
try {
|
||||
const cursor = await db.query(aql`
|
||||
RETURN ${now}
|
||||
`);
|
||||
const result = await cursor.next();
|
||||
// ...
|
||||
} catch (err) {
|
||||
// ...
|
||||
}
|
||||
})();
|
||||
|
||||
// or plain old Node-style
|
||||
var arangojs = require("arangojs");
|
||||
var db = new arangojs.Database();
|
||||
var now = Date.now();
|
||||
db
|
||||
.query({
|
||||
query: "RETURN @value",
|
||||
bindVars: { value: now }
|
||||
})
|
||||
.then(function(cursor) {
|
||||
return cursor.next().then(function(result) {
|
||||
// ...
|
||||
});
|
||||
})
|
||||
.catch(function(err) {
|
||||
// ...
|
||||
});
|
||||
|
||||
// Using different databases
|
||||
const db = new Database({
|
||||
url: "http://localhost:8529"
|
||||
});
|
||||
db.useDatabase("pancakes");
|
||||
db.useBasicAuth("root", "");
|
||||
// The database can be swapped at any time
|
||||
db.useDatabase("waffles");
|
||||
db.useBasicAuth("admin", "maplesyrup");
|
||||
|
||||
// Using ArangoDB behind a reverse proxy
|
||||
const db = new Database({
|
||||
url: "http://myproxy.local:8000",
|
||||
isAbsolute: true // don't automatically append database path to URL
|
||||
});
|
||||
|
||||
// Trigger ArangoDB 2.8 compatibility mode
|
||||
const db = new Database({
|
||||
arangoVersion: 20800
|
||||
});
|
||||
```
|
||||
|
||||
For AQL please check out the [`aql` template tag](../Reference/README.md#aql) for writing parametrized
|
||||
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](https://docs.arangodb.com/devel/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.
|
||||
|
||||
If the server response did not indicate an error but the response body could
|
||||
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.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
// Using async/await
|
||||
try {
|
||||
const info = await db.createDatabase('mydb');
|
||||
// database created
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
|
||||
// Using promises with arrow functions
|
||||
db.createDatabase('mydb')
|
||||
.then(
|
||||
info => {
|
||||
// database created
|
||||
},
|
||||
err => console.error(err.stack)
|
||||
);
|
||||
```
|
||||
|
||||
**Note**: 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.
|
|
@ -0,0 +1,15 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/arangodbjs.git / docs/Drivers/ -->
|
||||
# ArangoDB JavaScript Driver
|
||||
|
||||
The official ArangoDB low-level JavaScript client.
|
||||
|
||||
**Note:** if you are looking for the ArangoDB JavaScript API in
|
||||
[Foxx](https://foxx.arangodb.com) (or the `arangosh` interactive shell) please
|
||||
refer to the documentation about the
|
||||
[`@arangodb` module](https://docs.arangodb.com/latest/Manual/Foxx/Modules.html#the-arangodb-module)
|
||||
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)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,49 @@
|
|||
<!-- don't edit here, its 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>4.3.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>
|
||||
<tr><td>3.0.x</td><td>3.0.x</td><td>HTTP</td><td>1.6+</td></tr>
|
||||
<tr><td>2.7.4</td><td>2.7.x, 2.8.x</td><td>HTTP</td><td>1.6+</td></tr>
|
||||
</table>
|
||||
|
||||
**Note**: VelocyStream is only supported in ArangoDB 3.1 and above.
|
||||
|
||||
## Maven
|
||||
|
||||
To add the driver to your project with maven, add the following code to your pom.xml
|
||||
(please use a driver with a version number compatible to your ArangoDB server's version):
|
||||
|
||||
ArangoDB 3.x.x
|
||||
```XML
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>arangodb-java-driver</artifactId>
|
||||
<version>4.3.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
If you want to test with a snapshot version (e.g. 4.3.0-SNAPSHOT), add the staging repository of oss.sonatype.org to your pom.xml:
|
||||
|
||||
```XML
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>arangodb-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/groups/staging</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
## Compile the Java Driver
|
||||
|
||||
```
|
||||
mvn clean install -DskipTests=true -Dgpg.skip=true -Dmaven.javadoc.skip=true -B
|
||||
```
|
|
@ -0,0 +1,16 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
|
||||
# ArangoDB Java Driver
|
||||
|
||||
The official ArangoDB Java Driver.
|
||||
|
||||
- [Getting Started](GettingStarted/README.md)
|
||||
- [Reference](Reference/README.md)
|
||||
|
||||
## See Also
|
||||
|
||||
* [ChangeLog](https://raw.githubusercontent.com/arangodb/arangodb-java-driver/master/ChangeLog)
|
||||
* [Examples](https://github.com/arangodb/arangodb-java-driver/tree/master/src/test/java/com/arangodb/example)
|
||||
* [Tutorial](https://www.arangodb.com/tutorials/tutorial-sync-java-driver/)
|
||||
* [JavaDoc](http://arangodb.github.io/arangodb-java-driver/javadoc-4_3/index.html)
|
||||
* [JavaDoc VelocyPack](http://arangodb.github.io/java-velocypack/javadoc-1_0/index.html)
|
||||
|
|
@ -0,0 +1,676 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/arangodb-java-driver.git / docs/Drivers/ -->
|
||||
# ArangoDB Java Driver - Reference
|
||||
|
||||
# Driver setup
|
||||
|
||||
Setup with default configuration, this automatically loads a properties file arangodb.properties if exists in the classpath:
|
||||
|
||||
```Java
|
||||
// this instance is thread-safe
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().build();
|
||||
|
||||
```
|
||||
|
||||
The driver is configured with some default values:
|
||||
|
||||
<table>
|
||||
<tr><th>property-key</th><th>description</th><th>default value</th></tr>
|
||||
<tr><td>arangodb.hosts</td><td>ArangoDB hosts</td><td>127.0.0.1:8529</td></tr>
|
||||
<tr><td>arangodb.timeout</td><td>socket connect timeout(millisecond)</td><td>0</td></tr>
|
||||
<tr><td>arangodb.user</td><td>Basic Authentication User</td><td></td></tr>
|
||||
<tr><td>arangodb.password</td><td>Basic Authentication Password</td><td></td></tr>
|
||||
<tr><td>arangodb.useSsl</td><td>use SSL connection</td><td>false</td></tr>
|
||||
<tr><td>arangodb.chunksize</td><td>VelocyStream Chunk content-size(bytes)</td><td>30000</td></tr>
|
||||
<tr><td>arangodb.connections.max</td><td>max number of connections</td><td>1 VST, 20 HTTP</td></tr>
|
||||
<tr><td>arangodb.protocol</td><td>used network protocol</td><td>VST</td></tr>
|
||||
</table>
|
||||
|
||||
To customize the configuration the parameters can be changed in the code...
|
||||
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().host("192.168.182.50", 8888).build();
|
||||
|
||||
```
|
||||
... or with a custom properties file (my.properties)
|
||||
|
||||
```Java
|
||||
InputStream in = MyClass.class.getResourceAsStream("my.properties");
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().loadProperties(in).build();
|
||||
|
||||
```
|
||||
|
||||
Example for arangodb.properties:
|
||||
```Java
|
||||
arangodb.hosts=127.0.0.1:8529,127.0.0.1:8529
|
||||
arangodb.user=root
|
||||
arangodb.password=
|
||||
|
||||
```
|
||||
|
||||
## Network protocol
|
||||
|
||||
The drivers default used network protocol is the binary protocol VelocyStream which offers the best performance within the driver. To use HTTP, you have to set the configuration `useProtocol` to `Protocol.HTTP_JSON` for HTTP with Json content or `Protocol.HTTP_VPACK` for HTTP with [VelocyPack](https://github.com/arangodb/velocypack/blob/master/VelocyPack.md) content.
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().useProtocol(Protocol.VST).build();
|
||||
|
||||
```
|
||||
|
||||
In addition to set the configuration for HTTP you have to add the apache httpclient to your classpath.
|
||||
|
||||
```XML
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
**Note**: If you are using ArangoDB 3.0.x you have to set the protocol to `Protocol.HTTP_JSON` because it is the only one supported.
|
||||
|
||||
## SSL
|
||||
|
||||
To use SSL, you have to set the configuration `useSsl` to `true` and set a `SSLContext`. (see [example code](../src/test/java/com/arangodb/example/ssl/SslExample.java))
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().useSsl(true).sslContext(sc).build();
|
||||
|
||||
```
|
||||
|
||||
## 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`.
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().maxConnections(8).build();
|
||||
|
||||
```
|
||||
|
||||
## Fallback hosts
|
||||
|
||||
The driver supports configuring multiple hosts. The first host is used to open a connection to. When this host is not reachable the next host from the list is used. To use this feature just call the method `host(String, int)` multiple times.
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().host("host1", 8529).host("host2", 8529).build();
|
||||
|
||||
```
|
||||
|
||||
Since version 4.3 the driver support acquiring a list of known hosts in a cluster setup or a single server setup with followers. For this the driver has to be able to successfully open a connection to at least one host to get the list of hosts. Then it can use this list when fallback is needed. To use this feature just pass `true` to the method `acquireHostList(boolean)`.
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().acquireHostList(true).build();
|
||||
|
||||
```
|
||||
|
||||
## Load Balancing
|
||||
|
||||
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.
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ROUND_ROBIN).maxConnections(8).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();
|
||||
|
||||
```
|
||||
|
||||
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`.
|
||||
|
||||
|
||||
```Java
|
||||
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().loadBalancingStrategy(LoadBalancingStrategy.ONE_RANDOM).acquireHostList(true).build();
|
||||
|
||||
```
|
||||
|
||||
## configure VelocyPack serialization
|
||||
|
||||
Since version `4.1.11` you can extend the VelocyPack serialization by registering additional `VPackModule`s on `ArangoDB.Builder`.
|
||||
|
||||
### Java 8 types
|
||||
|
||||
Added support for:
|
||||
* java.time.Instant
|
||||
* java.time.LocalDate
|
||||
* java.time.LocalDateTime
|
||||
* java.util.Optional;
|
||||
* java.util.OptionalDouble;
|
||||
* java.util.OptionalInt;
|
||||
* java.util.OptionalLong;
|
||||
|
||||
```XML
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>velocypack-module-jdk8</artifactId>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().registerModule(new VPackJdk8Module()).build();
|
||||
```
|
||||
|
||||
### Scala types
|
||||
|
||||
Added support for:
|
||||
* scala.Option
|
||||
* scala.collection.immutable.List
|
||||
* scala.collection.immutable.Map
|
||||
|
||||
```XML
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>velocypack-module-scala</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
```Scala
|
||||
val arangoDB: ArangoDB = new ArangoDB.Builder().registerModule(new VPackScalaModule).build
|
||||
```
|
||||
|
||||
### Joda-Time
|
||||
|
||||
Added support for:
|
||||
* org.joda.time.DateTime;
|
||||
* org.joda.time.Instant;
|
||||
* org.joda.time.LocalDate;
|
||||
* org.joda.time.LocalDateTime;
|
||||
|
||||
```XML
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>velocypack-module-joda</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().registerModule(new VPackJodaModule()).build();
|
||||
```
|
||||
|
||||
## custom serializer
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().registerModule(new VPackModule() {
|
||||
@Override
|
||||
public <C extends VPackSetupContext<C>> void setup(final C context) {
|
||||
context.registerDeserializer(MyObject.class, new VPackDeserializer<MyObject>() {
|
||||
@Override
|
||||
public MyObject deserialize(VPackSlice parent,VPackSlice vpack,
|
||||
VPackDeserializationContext context) throws VPackException {
|
||||
MyObject obj = new MyObject();
|
||||
obj.setName(vpack.get("name").getAsString());
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
context.registerSerializer(MyObject.class, new VPackSerializer<MyObject>() {
|
||||
@Override
|
||||
public void serialize(VPackBuilder builder,String attribute,MyObject value,
|
||||
VPackSerializationContext context) throws VPackException {
|
||||
builder.add(attribute, ValueType.OBJECT);
|
||||
builder.add("name", value.getName());
|
||||
builder.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).build();
|
||||
```
|
||||
|
||||
|
||||
# Manipulating databases
|
||||
|
||||
## create database
|
||||
```Java
|
||||
// create database
|
||||
arangoDB.createDatabase("myDatabase");
|
||||
|
||||
```
|
||||
|
||||
## drop database
|
||||
```Java
|
||||
// drop database
|
||||
arangoDB.db("myDatabase").drop();
|
||||
|
||||
```
|
||||
|
||||
# Manipulating collections
|
||||
|
||||
## create collection
|
||||
```Java
|
||||
// create collection
|
||||
arangoDB.db("myDatabase").createCollection("myCollection", null);
|
||||
|
||||
```
|
||||
|
||||
## drop collection
|
||||
```Java
|
||||
// delete collection
|
||||
arangoDB.db("myDatabase").collection("myCollection").drop();
|
||||
|
||||
```
|
||||
|
||||
## truncate collection
|
||||
```Java
|
||||
arangoDB.db("myDatabase").collection("myCollection").truncate();
|
||||
```
|
||||
|
||||
# Basic Document operations
|
||||
|
||||
Every document operations works with POJOs (e.g. MyObject), VelocyPack (VPackSlice) and Json (String).
|
||||
|
||||
For the next examples we use a small object:
|
||||
|
||||
```Java
|
||||
public class MyObject {
|
||||
|
||||
private String key;
|
||||
private String name;
|
||||
private int age;
|
||||
|
||||
public MyObject(String name, int age) {
|
||||
this();
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public MyObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
/*
|
||||
* + getter and setter
|
||||
*/
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## insert document
|
||||
```Java
|
||||
MyObject myObject = new MyObject("Homer", 38);
|
||||
arangoDB.db("myDatabase").collection("myCollection").insertDocument(myObject);
|
||||
|
||||
```
|
||||
|
||||
When creating a document, the attributes of the object will be stored as key-value pair
|
||||
E.g. in the previous example the object was stored as follows:
|
||||
```properties
|
||||
"name" : "Homer"
|
||||
"age" : "38"
|
||||
```
|
||||
|
||||
## delete document
|
||||
```Java
|
||||
arangoDB.db("myDatabase").collection("myCollection").deleteDocument(myObject.getKey());
|
||||
|
||||
```
|
||||
|
||||
## update document
|
||||
```Java
|
||||
arangoDB.db("myDatabase").collection("myCollection").updateDocument(myObject.getKey(), myUpdatedObject);
|
||||
|
||||
```
|
||||
|
||||
## replace document
|
||||
```Java
|
||||
arangoDB.db("myDatabase").collection("myCollection").replaceDocument(myObject.getKey(), myObject2);
|
||||
|
||||
```
|
||||
|
||||
## read document as JavaBean
|
||||
```Java
|
||||
MyObject document = arangoDB.db("myDatabase").collection("myCollection").getDocument(myObject.getKey(), MyObject.class);
|
||||
document.getName();
|
||||
document.getAge();
|
||||
|
||||
```
|
||||
|
||||
## read document as VelocyPack
|
||||
```Java
|
||||
VPackSlice document = arangoDB.db("myDatabase").collection("myCollection").getDocument(myObject.getKey(), VPackSlice.class);
|
||||
document.get("name").getAsString();
|
||||
document.get("age").getAsInt();
|
||||
|
||||
```
|
||||
|
||||
## read document as Json
|
||||
```Java
|
||||
String json = arangoDB.db("myDatabase").collection("myCollection").getDocument(myObject.getKey(), String.class);
|
||||
|
||||
```
|
||||
|
||||
## read document by key
|
||||
```Java
|
||||
arangoDB.db("myDatabase").collection("myCollection").getDocument("myKey", MyObject.class);
|
||||
|
||||
```
|
||||
|
||||
## read document by id
|
||||
```Java
|
||||
arangoDB.db("myDatabase").getDocument("myCollection/myKey", MyObject.class);
|
||||
|
||||
```
|
||||
|
||||
# Multi Document operations
|
||||
|
||||
## insert documents
|
||||
```Java
|
||||
Collection<MyObject> documents = new ArrayList<>;
|
||||
documents.add(myObject1);
|
||||
documents.add(myObject2);
|
||||
documents.add(myObject3);
|
||||
arangoDB.db("myDatabase").collection("myCollection").insertDocuments(documents);
|
||||
|
||||
```
|
||||
|
||||
## delete documents
|
||||
```Java
|
||||
Collection<String> keys = new ArrayList<>;
|
||||
keys.add(myObject1.getKey());
|
||||
keys.add(myObject2.getKey());
|
||||
keys.add(myObject3.getKey());
|
||||
arangoDB.db("myDatabase").collection("myCollection").deleteDocuments(keys);
|
||||
|
||||
```
|
||||
|
||||
## update documents
|
||||
```Java
|
||||
Collection<MyObject> documents = new ArrayList<>;
|
||||
documents.add(myObject1);
|
||||
documents.add(myObject2);
|
||||
documents.add(myObject3);
|
||||
arangoDB.db("myDatabase").collection("myCollection").updateDocuments(documents);
|
||||
|
||||
```
|
||||
|
||||
## replace documents
|
||||
```Java
|
||||
Collection<MyObject> documents = new ArrayList<>;
|
||||
documents.add(myObject1);
|
||||
documents.add(myObject2);
|
||||
documents.add(myObject3);
|
||||
arangoDB.db("myDatabase").collection("myCollection").replaceDocuments(documents);
|
||||
|
||||
```
|
||||
|
||||
# AQL
|
||||
|
||||
## Executing an AQL statement
|
||||
|
||||
Every AQL operations works with POJOs (e.g. MyObject), VelocyPack (VPackSlice) and Json (String).
|
||||
|
||||
E.g. get all Simpsons aged 3 or older in ascending order:
|
||||
|
||||
```Java
|
||||
arangoDB.createDatabase("myDatabase");
|
||||
ArangoDatabase db = arangoDB.db("myDatabase");
|
||||
|
||||
db.createCollection("myCollection");
|
||||
ArangoCollection collection = db.collection("myCollection");
|
||||
|
||||
collection.insertDocument(new MyObject("Homer", 38));
|
||||
collection.insertDocument(new MyObject("Marge", 36));
|
||||
collection.insertDocument(new MyObject("Bart", 10));
|
||||
collection.insertDocument(new MyObject("Lisa", 8));
|
||||
collection.insertDocument(new MyObject("Maggie", 2));
|
||||
|
||||
Map<String, Object> bindVars = new HashMap<>();
|
||||
bindVars.put("age", 3);
|
||||
|
||||
ArangoCursor<MyObject> cursor = db.query(query, bindVars, null, MyObject.class);
|
||||
|
||||
for(; cursor.hasNext;) {
|
||||
MyObject obj = cursor.next();
|
||||
System.out.println(obj.getName());
|
||||
}
|
||||
```
|
||||
|
||||
or return the AQL result as VelocyPack:
|
||||
|
||||
```Java
|
||||
ArangoCursor<VPackSlice> cursor = db.query(query, bindVars, null, VPackSlice.class);
|
||||
|
||||
for(; cursor.hasNext;) {
|
||||
VPackSlice obj = cursor.next();
|
||||
System.out.println(obj.get("name").getAsString());
|
||||
}
|
||||
```
|
||||
|
||||
**Note**: The parameter `type` in `query()` has to match the result of the query, otherwise you get an VPackParserException. E.g. you set `type` to `BaseDocument` or a POJO and the query result is an array or simple type, you get an VPackParserException caused by VPackValueTypeException: Expecting type OBJECT.
|
||||
|
||||
# Graphs
|
||||
|
||||
The driver supports the [graph api](https://docs.arangodb.com/HTTP/Gharial/index.html).
|
||||
|
||||
Some of the basic graph operations are described in the following:
|
||||
|
||||
## add graph
|
||||
A graph consists of vertices and edges (stored in collections). Which collections are used within a graph is defined via edge definitions. A graph can contain more than one edge definition, at least one is needed.
|
||||
|
||||
```Java
|
||||
Collection<EdgeDefinition> edgeDefinitions = new ArrayList<>();
|
||||
EdgeDefinition edgeDefinition = new EdgeDefinition();
|
||||
// define the edgeCollection to store the edges
|
||||
edgeDefinition.collection("myEdgeCollection");
|
||||
// define a set of collections where an edge is going out...
|
||||
edgeDefinition.from("myCollection1", "myCollection2");
|
||||
|
||||
// repeat this for the collections where an edge is going into
|
||||
edgeDefinition.to("myCollection1", "myCollection3");
|
||||
|
||||
edgeDefinitions.add(edgeDefinition);
|
||||
|
||||
// A graph can contain additional vertex collections, defined in the set of orphan collections
|
||||
GraphCreateOptions options = new GraphCreateOptions();
|
||||
options.orphanCollections("myCollection4", "myCollection5");
|
||||
|
||||
// now it's possible to create a graph
|
||||
arangoDB.db("myDatabase").createGraph("myGraph", edgeDefinitions, options);
|
||||
|
||||
```
|
||||
|
||||
## delete graph
|
||||
|
||||
A graph can be deleted by its name
|
||||
|
||||
```Java
|
||||
arangoDB.db("myDatabase").graph("myGraph").drop();
|
||||
```
|
||||
|
||||
## add vertex
|
||||
|
||||
Vertices are stored in the vertex collections defined above.
|
||||
|
||||
```Java
|
||||
MyObject myObject1 = new MyObject("Homer", 38);
|
||||
MyObject myObject2 = new MyObject("Marge", 36);
|
||||
arangoDB.db("myDatabase").graph("myGraph").vertexCollection("collection1").insertVertex(myObject1, null);
|
||||
arangoDB.db("myDatabase").graph("myGraph").vertexCollection("collection3").insertVertex(myObject2, null);
|
||||
|
||||
```
|
||||
|
||||
## add edge
|
||||
|
||||
Now an edge can be created to set a relation between vertices
|
||||
|
||||
```Java
|
||||
arangoDB.db("myDatabase").graph("myGraph").edgeCollection("myEdgeCollection").insertEdge(myEdgeObject, null);
|
||||
|
||||
```
|
||||
|
||||
# Foxx
|
||||
|
||||
## call a service
|
||||
```Java
|
||||
Request request = new Request("mydb", RequestType.GET, "/my/foxx/service")
|
||||
Response response = arangoDB.execute(request);
|
||||
|
||||
```
|
||||
|
||||
# User management
|
||||
|
||||
If you are using [authentication] (https://docs.arangodb.com/Manual/GettingStarted/Authentication.html) you can manage users with the driver.
|
||||
|
||||
## add user
|
||||
```Java
|
||||
//username, password
|
||||
arangoDB.createUser("myUser", "myPassword");
|
||||
```
|
||||
|
||||
## delete user
|
||||
```Java
|
||||
arangoDB.deleteUser("myUser");
|
||||
```
|
||||
|
||||
## list users
|
||||
```Java
|
||||
Collection<UserResult> users = arangoDB.getUsers();
|
||||
for(UserResult user : users) {
|
||||
System.out.println(user.getUser())
|
||||
}
|
||||
```
|
||||
|
||||
## grant user access
|
||||
```Java
|
||||
arangoDB.db("myDatabase").grantAccess("myUser");
|
||||
````
|
||||
|
||||
## revoke user access
|
||||
```Java
|
||||
arangoDB.db("myDatabase").revokeAccess("myUser");
|
||||
````
|
||||
|
||||
# Serialization
|
||||
|
||||
## JavaBeans
|
||||
The driver can serialize/deserialize JavaBeans. They need at least a constructor without parameter.
|
||||
|
||||
```Java
|
||||
public class MyObject {
|
||||
|
||||
private String name;
|
||||
private Gender gender;
|
||||
private int age;
|
||||
|
||||
public MyObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## internal fields
|
||||
To use Arango-internal fields (like _id, _key, _rev, _from, _to) in your JavaBeans, use the annotation `DocumentField`.
|
||||
|
||||
```Java
|
||||
public class MyObject {
|
||||
|
||||
@DocumentField(Type.KEY)
|
||||
private String key;
|
||||
|
||||
private String name;
|
||||
private Gender gender;
|
||||
private int age;
|
||||
|
||||
public MyObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## serialized fieldnames
|
||||
To use a different serialized name for a field, use the annotation `SerializedName`.
|
||||
|
||||
```Java
|
||||
public class MyObject {
|
||||
|
||||
@SerializedName("title")
|
||||
private String name;
|
||||
|
||||
private Gender gender;
|
||||
private int age;
|
||||
|
||||
public MyObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## ignore fields
|
||||
To ignore fields at serialization/deserialization, use the annotation `Expose`
|
||||
|
||||
```Java
|
||||
public class MyObject {
|
||||
|
||||
@Expose
|
||||
private String name;
|
||||
@Expose(serialize = true, deserialize = false)
|
||||
private Gender gender;
|
||||
private int age;
|
||||
|
||||
public MyObject() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## custom serializer
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder().registerModule(new VPackModule() {
|
||||
@Override
|
||||
public <C extends VPackSetupContext<C>> void setup(final C context) {
|
||||
context.registerDeserializer(MyObject.class, new VPackDeserializer<MyObject>() {
|
||||
@Override
|
||||
public MyObject deserialize(VPackSlice parent,VPackSlice vpack,
|
||||
VPackDeserializationContext context) throws VPackException {
|
||||
MyObject obj = new MyObject();
|
||||
obj.setName(vpack.get("name").getAsString());
|
||||
return obj;
|
||||
}
|
||||
});
|
||||
context.registerSerializer(MyObject.class, new VPackSerializer<MyObject>() {
|
||||
@Override
|
||||
public void serialize(VPackBuilder builder,String attribute,MyObject value,
|
||||
VPackSerializationContext context) throws VPackException {
|
||||
builder.add(attribute, ValueType.OBJECT);
|
||||
builder.add("name", value.getName());
|
||||
builder.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).build();
|
||||
```
|
||||
|
||||
## manually serialization
|
||||
To de-/serialize from and to VelocyPack before or after a database call, use the `ArangoUtil` from the method `util()` in `ArangoDB`, `ArangoDatabase`, `ArangoCollection`, `ArangoGraph`, `ArangoEdgeCollection`or `ArangoVertexCollection`.
|
||||
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder();
|
||||
VPackSlice vpack = arangoDB.util().serialize(myObj);
|
||||
```
|
||||
|
||||
```Java
|
||||
ArangoDB arangoDB = new ArangoDB.Builder();
|
||||
MyObject myObj = arangoDB.util().deserialize(vpack, MyObject.class);
|
||||
```
|
|
@ -0,0 +1,6 @@
|
|||
ArangoDB VERSION_NUMBER HTTP API Driver Documentation
|
||||
=====================================================
|
||||
|
||||
Welcome to the ArangoDB Driver documentation!
|
||||
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
# Summary
|
||||
* [Introduction](README.md)
|
||||
# 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)
|
||||
# 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)
|
||||
# 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)
|
|
@ -0,0 +1,114 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
|
||||
# Spring Data ArangoDB - Getting Started
|
||||
|
||||
## Supported versions
|
||||
|
||||
| Spring Data ArangoDB | Spring Data | ArangoDB |
|
||||
|----------------------|-------------|----------------|
|
||||
| 1.0.0 | 1.13.x | 3.0*, 3.1, 3.2 |
|
||||
| 2.0.0 | 2.0.x | 3.0*, 3.1, 3.2 |
|
||||
|
||||
Spring Data ArangoDB requires ArangoDB 3.0 or higher - which you can download [here](https://www.arangodb.com/download/) - and Java 8 or higher.
|
||||
|
||||
**Note**: ArangoDB 3.0 does not support the default transport protocol [VelocyStream](https://github.com/arangodb/velocystream). A manual switch to HTTP is required. See chapter [configuration](#configuration). Also ArangoDB 3.0 does not support geospatial queries.
|
||||
|
||||
## Maven
|
||||
|
||||
To use Spring Data ArangoDB in your project, your build automation tool needs to be configured to include and use the Spring Data ArangoDB dependency. Example with Maven:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.arangodb</groupId>
|
||||
<artifactId>arangodb-spring-data</artifactId>
|
||||
<version>{version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
There is a [demonstration app](https://github.com/arangodb/spring-data-demo), which contains common use cases and examples of how to use Spring Data ArangoDB's functionality.
|
||||
|
||||
## Configuration
|
||||
|
||||
You can use Java to configure your Spring Data environment as show below. Setting up the underlying driver (`ArangoDB.Builder`) with default configuration automatically loads a properties file `arangodb.properties`, if it exists in the classpath.
|
||||
|
||||
```java
|
||||
@Configuration
|
||||
@EnableArangoRepositories(basePackages = { "com.company.mypackage" })
|
||||
public class MyConfiguration extends AbstractArangoConfiguration {
|
||||
|
||||
@Override
|
||||
public ArangoDB.Builder arango() {
|
||||
return new ArangoDB.Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String database() {
|
||||
// Name of the database to be used
|
||||
return "example-database";
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
The driver is configured with some default values:
|
||||
|
||||
property-key | description | default value
|
||||
-------------|-------------|--------------
|
||||
arangodb.host | ArangoDB host | 127.0.0.1
|
||||
arangodb.port | ArangoDB port | 8529
|
||||
arangodb.timeout | socket connect timeout(millisecond) | 0
|
||||
arangodb.user | Basic Authentication User |
|
||||
arangodb.password | Basic Authentication Password |
|
||||
arangodb.useSsl | use SSL connection | false
|
||||
|
||||
To customize the configuration, the parameters can be changed in the Java code.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public ArangoDB.Builder arango() {
|
||||
ArangoDB.Builder arango = new ArangoDB.Builder()
|
||||
.host("127.0.0.1")
|
||||
.port(8429)
|
||||
.user("root");
|
||||
return arango;
|
||||
}
|
||||
```
|
||||
|
||||
In addition you can use the *arangodb.properties* or a custom properties file to supply credentials to the driver.
|
||||
|
||||
*Properties file*
|
||||
```
|
||||
arangodb.host=127.0.0.1
|
||||
arangodb.port=8529
|
||||
# arangodb.hosts=127.0.0.1:8529 could be used instead
|
||||
arangodb.user=root
|
||||
arangodb.password=
|
||||
```
|
||||
|
||||
*Custom properties file*
|
||||
```java
|
||||
@Override
|
||||
public ArangoDB.Builder arango() {
|
||||
InputStream in = MyClass.class.getResourceAsStream("my.properties");
|
||||
ArangoDB.Builder arango = new ArangoDB.Builder()
|
||||
.loadProperties(in);
|
||||
return arango;
|
||||
}
|
||||
```
|
||||
|
||||
**Note**: When using ArangoDB 3.0 it is required to set the transport protocol to HTTP and fetch the dependency `org.apache.httpcomponents:httpclient`.
|
||||
|
||||
```java
|
||||
@Override
|
||||
public ArangoDB.Builder arango() {
|
||||
ArangoDB.Builder arango = new ArangoDB.Builder()
|
||||
.useProtocol(Protocol.HTTP_JSON);
|
||||
return arango;
|
||||
}
|
||||
```
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.1</version>
|
||||
</dependency>
|
||||
```
|
|
@ -0,0 +1,12 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
|
||||
# Spring Data ArangoDB
|
||||
|
||||
- [Getting Started](GettingStarted/README.md)
|
||||
- [Reference](Reference/README.md)
|
||||
|
||||
## Learn more
|
||||
* [ArangoDB](https://www.arangodb.com/)
|
||||
* [Demo](https://github.com/arangodb/spring-data-demo)
|
||||
* [JavaDoc 1.0.0](http://arangodb.github.io/spring-data/javadoc-1_0/index.html)
|
||||
* [JavaDoc 2.0.0](http://arangodb.github.io/spring-data/javadoc-2_0/index.html)
|
||||
* [JavaDoc Java driver](http://arangodb.github.io/arangodb-java-driver/javadoc-4_3/index.html)
|
|
@ -0,0 +1,620 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/spring-data.git / docs/Drivers/ -->
|
||||
# Spring Data ArangoDB - Reference
|
||||
|
||||
# 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.
|
||||
The `ArangoTemplate` class is the default implementation of the operations interface `ArangoOperations` which developers of Spring Data are encouraged to code against.
|
||||
|
||||
# Repositories
|
||||
|
||||
## Introduction
|
||||
|
||||
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.
|
||||
|
||||
## Instantiating
|
||||
|
||||
Instances of a Repository are created in Spring beans through the auto-wired mechanism of Spring.
|
||||
|
||||
```java
|
||||
public class MySpringBean {
|
||||
|
||||
@Autowired
|
||||
private MyRepository rep;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Return types
|
||||
|
||||
The method return type for single results can be a primitive type, a domain class, `Map<String, Object>`, `BaseDocument`, `BaseEdgeDocument`, `Optional<Type>`, `GeoResult<Type>`.
|
||||
The method return type for multiple results can additionally be `ArangoCursor<Type>`, `Iterable<Type>`, `Collection<Type>`, `List<Type>`, `Set<Type>`, `Page<Type>`, `Slice<Type>`, `GeoPage<Type>`, `GeoResults<Type>` where Type can be everything a single result can be.
|
||||
|
||||
## 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. `AqlQueryOptions` can also be passed to the driver, as an argument anywhere in the method signature.
|
||||
|
||||
There are three ways of passing bind parameters to the query in the query annotation.
|
||||
|
||||
Using number matching, arguments will be substituted into the query in the order they are passed to the query method.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String>{
|
||||
|
||||
@Query("FOR c IN customers FILTER c.name == @0 AND c.surname == @2 RETURN c")
|
||||
ArangoCursor<Customer> query(String name, AqlQueryOptions options, String surname);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
With the `@Param` annotation, the argument will be placed in the query at the place corresponding to the value passed to the `@Param` annotation.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String>{
|
||||
|
||||
@Query("FOR c IN customers FILTER c.name == @name AND c.surname == @surname RETURN c")
|
||||
ArangoCursor<Customer> query(@Param("name") String name, @Param("surname") String surname);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
In addition you can use a parameter of type `Map<String, Object>` annotated with `@BindVars` as your bind parameters. You can then fill the map with any parameter used in the query. (see [here](https://docs.arangodb.com/3.1/AQL/Fundamentals/BindParameters.html#bind-parameters) for more Information about Bind Parameters).
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String>{
|
||||
|
||||
@Query("FOR c IN customers FILTER c.name == @name AND c.surname = @surname RETURN c")
|
||||
ArangoCursor<Customer> query(@BindVars Map<String, Object> bindVars);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
A mixture of any of these methods can be used. Parameters with the same name from an `@Param` annotation will override those in the `bindVars`.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String>{
|
||||
|
||||
@Query("FOR c IN customers FILTER c.name == @name AND c.surname = @surname RETURN c")
|
||||
ArangoCursor<Customer> query(@BindVars Map<String, Object> bindVars, @Param("name") String name);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Derived queries
|
||||
|
||||
Spring Data ArangoDB supports queries derived from methods names by splitting it into its semantic parts and converting into AQL. The mechanism strips the prefixes `find..By`, `get..By`, `query..By`, `read..By`, `stream..By`, `count..By`, `exists..By`, `delete..By`, `remove..By` from the method and parses the rest. The By acts as a separator to indicate the start of the criteria for the query to be built. You can define conditions on entity properties and concatenate them with `And` and `Or`.
|
||||
|
||||
The complete list of part types for derived methods is below, where doc is a document in the database
|
||||
|
||||
Keyword | Sample | Predicate
|
||||
----------|----------------|--------
|
||||
IsGreaterThan, GreaterThan, After | findByAgeGreaterThan(int age) | doc.age > age
|
||||
IsGreaterThanEqual, GreaterThanEqual | findByAgeIsGreaterThanEqual(int age) | doc.age >= age
|
||||
IsLessThan, LessThan, Before | findByAgeIsLessThan(int age) | doc.age < age
|
||||
IsLessThanEqualLessThanEqual | findByAgeLessThanEqual(int age) | doc.age <= age
|
||||
IsBetween, Between | findByAgeBetween(int lower, int upper) | lower < doc.age < upper
|
||||
IsNotNull, NotNull | findByNameNotNull() | doc.name != null
|
||||
IsNull, Null | findByNameNull() | doc.name == null
|
||||
IsLike, Like | findByNameLike(String name) | doc.name LIKE name
|
||||
IsNotLike, NotLike | findByNameNotLike(String name) | NOT(doc.name LIKE name)
|
||||
IsStartingWith, StartingWith, StartsWith | findByNameStartsWith(String prefix) | doc.name LIKE prefix
|
||||
IsEndingWith, EndingWith, EndsWith | findByNameEndingWith(String suffix) | doc.name LIKE suffix
|
||||
Regex, MatchesRegex, Matches | findByNameRegex(String pattern) | REGEX_TEST(doc.name, name, ignoreCase)
|
||||
(No Keyword) | findByFirstName(String name) | doc.name == name
|
||||
IsTrue, True | findByActiveTrue() | doc.active == true
|
||||
IsFalse, False | findByActiveFalse() | doc.active == false
|
||||
Is, Equals | findByAgeEquals(int age) | doc.age == age
|
||||
IsNot, Not | findByAgeNot(int age) | doc.age != age
|
||||
IsIn, In | findByNameIn(String[] names) | doc.name IN names
|
||||
IsNotIn, NotIn | findByNameIsNotIn(String[] names) | doc.name NOT IN names
|
||||
IsContaining, Containing, Contains | findByFriendsContaining(String name) | name IN doc.friends
|
||||
IsNotContaining, NotContaining, NotContains | findByFriendsNotContains(String name) | name NOT IN doc.friends
|
||||
Exists | findByFriendNameExists() | HAS(doc.friend, name)
|
||||
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
// FOR c IN customers FILTER c.name == @0 RETURN c
|
||||
ArangoCursor<Customer> findByName(String name);
|
||||
ArangoCursor<Customer> getByName(String name);
|
||||
|
||||
// FOR c IN customers
|
||||
// FILTER c.name == @0 && c.age == @1
|
||||
// RETURN c
|
||||
ArangoCursor<Customer> findByNameAndAge(String name, int age);
|
||||
|
||||
// FOR c IN customers
|
||||
// FILTER c.name == @0 || c.age == @1
|
||||
// RETURN c
|
||||
ArangoCursor<Customer> findByNameOrAge(String name, int age);
|
||||
}
|
||||
```
|
||||
|
||||
You can apply sorting for one or multiple sort criteria by appending `OrderBy` to the method and `Asc` or `Desc` for the directions.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
// FOR c IN customers
|
||||
// FITLER c.name == @0
|
||||
// SORT c.age DESC RETURN c
|
||||
ArangoCursor<Customer> getByNameOrderByAgeDesc(String name);
|
||||
|
||||
// FOR c IN customers
|
||||
// FILTER c.name = @0
|
||||
// SORT c.name ASC, c.age DESC RETURN c
|
||||
ArangoCursor<Customer> findByNameOrderByNameAscAgeDesc(String name);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Geospatial queries
|
||||
|
||||
Geospatial queries are a subsection of derived queries. To use a geospatial query on a collection, a geo index must exist on that collection. A geo index can be created on a field which is a two element array, corresponding to latitude and longitude coordinates.
|
||||
|
||||
As a subsection of derived queries, geospatial queries support all the same return types, but also support the three return types `GeoPage, GeoResult and Georesults`. These types must be used in order to get the distance of each document as generated by the query.
|
||||
|
||||
There are two kinds of geospatial query, Near and Within. Near sorts documents by distance from the given point, while within both sorts and filters documents, returning those within the given distance range or shape.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<City, String> {
|
||||
|
||||
GeoResult<City> getByLocationNear(Point point);
|
||||
|
||||
GeoResults<City> findByLocationWithinOrLocationWithin(Box box, Polygon polygon);
|
||||
|
||||
//Equivalent queries
|
||||
GeoResults<City> findByLocationWithinOrLocationWithin(Point point, int distance);
|
||||
GeoResults<City> findByLocationWithinOrLocationWithin(Point point, Distance distance);
|
||||
GeoResults<City> findByLocationWithinOrLocationWithin(Circle circle);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Property expression
|
||||
|
||||
Property expressions can refer only to direct and nested properties of the managed domain class. The algorithm checks the domain class for the entire expression as the property. If the check fails, the algorithm splits up the expression at the camel case parts from the right and tries to find the corresponding property.
|
||||
|
||||
```java
|
||||
@Document("customers")
|
||||
public class Customer {
|
||||
private Address address;
|
||||
}
|
||||
|
||||
public class Address {
|
||||
private ZipCode zipCode;
|
||||
}
|
||||
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
// 1. step: search domain class for a property "addressZipCode"
|
||||
// 2. step: search domain class for "addressZip.code"
|
||||
// 3. step: search domain class for "address.zipCode"
|
||||
ArangoCursor<Customer> findByAddressZipCode(ZipCode zipCode);
|
||||
}
|
||||
```
|
||||
|
||||
It is possible for the algorithm to select the wrong property if the domain class also has a property which matches the first split of the expression. To resolve this ambiguity you can use _ as a separator inside your method-name to define traversal points.
|
||||
|
||||
```java
|
||||
@Document("customers")
|
||||
public class Customer {
|
||||
private Address address;
|
||||
private AddressZip addressZip;
|
||||
}
|
||||
|
||||
public class Address {
|
||||
private ZipCode zipCode;
|
||||
}
|
||||
|
||||
public class AddressZip {
|
||||
private String code;
|
||||
}
|
||||
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
// 1. step: search domain class for a property "addressZipCode"
|
||||
// 2. step: search domain class for "addressZip.code"
|
||||
// creates query with "x.addressZip.code"
|
||||
ArangoCursor<Customer> findByAddressZipCode(ZipCode zipCode);
|
||||
|
||||
// 1. step: search domain class for a property "addressZipCode"
|
||||
// 2. step: search domain class for "addressZip.code"
|
||||
// 3. step: search domain class for "address.zipCode"
|
||||
// creates query with "x.address.zipCode"
|
||||
ArangoCursor<Customer> findByAddress_ZipCode(ZipCode zipCode);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
## Special parameter handling
|
||||
|
||||
### Bind parameters
|
||||
|
||||
AQL supports the usage of [bind parameters](https://docs.arangodb.com/3.1/AQL/Fundamentals/BindParameters.html) which you can define with a method parameter named `bindVars` of type `Map<String, Object>`.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
@Query("FOR c IN customers FILTER c[@field] == @value RETURN c")
|
||||
ArangoCursor<Customer> query(Map<String, Object> bindVars);
|
||||
|
||||
}
|
||||
|
||||
Map<String, Object> bindVars = new HashMap<String, Object>();
|
||||
bindVars.put("field", "name");
|
||||
bindVars.put("value", "john";
|
||||
|
||||
// will execute query "FOR c IN customers FILTER c.name == "john" RETURN c"
|
||||
ArangoCursor<Customer> cursor = myRepo.query(bindVars);
|
||||
```
|
||||
|
||||
### AQL query options
|
||||
|
||||
You can set additional options for the query and the created cursor over the class `AqlQueryOptions` which you can simply define as a method parameter without a specific name. AqlQuery options can also be defined with the `@QueryOptions` annotation, as shown below. AqlQueryOptions from an annotation and those from an argument are merged if both exist, with those in the argument taking precedence.
|
||||
|
||||
The `AqlQueryOptions` allows you to set the cursor time-to-life, batch-size, caching flag and several other settings. This special parameter works with both query-methods and finder-methods. Keep in mind that some options, like time-to-life, are only effective if the method return type is`ArangoCursor<T>` or `Iterable<T>`.
|
||||
|
||||
```java
|
||||
public interface MyRepository extends Repository<Customer, String> {
|
||||
|
||||
|
||||
@Query("FOR c IN customers FILTER c.name == @0 RETURN c")
|
||||
Iterable<Customer> query(String name, AqlQueryOptions options);
|
||||
|
||||
|
||||
Iterable<Customer> findByName(String name, AqlQueryOptions options);
|
||||
|
||||
|
||||
@QueryOptions(maxPlans = 1000, ttl = 128)
|
||||
ArangoCursor<Customer> findByAddressZipCode(ZipCode zipCode);
|
||||
|
||||
|
||||
@Query("FOR c IN customers FILTER c[@field] == @value RETURN c")
|
||||
@QueryOptions(cache = true, ttl = 128)
|
||||
ArangoCursor<Customer> query(Map<String, Object> bindVars, AqlQueryOptions options);
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
# Mapping
|
||||
|
||||
## Introduction
|
||||
|
||||
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.
|
||||
|
||||
## Conventions
|
||||
|
||||
* The Java class name is mapped to the collection name
|
||||
* The non-static fields of a Java object are used as fields in the stored document
|
||||
* The Java field name is mapped to the stored document field name
|
||||
* All nested Java object are stored as nested objects in the stored document
|
||||
* The Java class needs a constructor which meets the following criteria:
|
||||
* in case of a single constructor:
|
||||
* a non-parameterized constructor or
|
||||
* a parameterized constructor
|
||||
* in case of multiple constructors:
|
||||
* a non-parameterized constructor or
|
||||
* a parameterized constructor annotated with `@PersistenceConstructor`
|
||||
|
||||
## Type conventions
|
||||
|
||||
ArangoDB uses [VelocyPack](https://github.com/arangodb/velocypack) as it's internal storage format which supports a large number of data types. In addition Spring Data ArangoDB offers - with the underlying Java driver - built-in converters to add additional types to the mapping.
|
||||
|
||||
Java type | VelocyPack type
|
||||
----------|----------------
|
||||
java.lang.String | string
|
||||
java.lang.Boolean | bool
|
||||
java.lang.Integer | signed int 4 bytes, smallint
|
||||
java.lang.Long | signed int 8 bytes, smallint
|
||||
java.lang.Short | signed int 2 bytes, smallint
|
||||
java.lang.Double | double
|
||||
java.lang.Float | double
|
||||
java.math.BigInteger | signed int 8 bytes, unsigned int 8 bytes
|
||||
java.math.BigDecimal | double
|
||||
java.lang.Number | double
|
||||
java.lang.Character | string
|
||||
java.util.Date | string (date-format ISO 8601)
|
||||
java.sql.Date | string (date-format ISO 8601)
|
||||
java.sql.Timestamp | string (date-format ISO 8601)
|
||||
java.util.UUID | string
|
||||
java.lang.byte[] | string (Base64)
|
||||
|
||||
## Annotations
|
||||
|
||||
### Annotation overview
|
||||
|
||||
annotation | level | description
|
||||
-----------|-------|------------
|
||||
@Document | class | marks this class as a candidate for mapping
|
||||
@Edge | class | marks this class as a candidate for mapping
|
||||
@Id | field | stores the field as the system field _id
|
||||
@Key | field | stores the field as the system field _key
|
||||
@Rev | field | stores the field as the system field _rev
|
||||
@Field("alt-name") | field | stores the field with an alternative name
|
||||
@Ref | field | stores the _id of the referenced document and not the nested document
|
||||
@From | field | stores the _id of the referenced document as the system field _from
|
||||
@To | field | stores the _id of the referenced document as the system field _to
|
||||
@Relations | field | vertices which are connected over edges
|
||||
@HashIndex | class | describes a hash index
|
||||
@HashIndexed | field | describes how to index the field
|
||||
@SkiplistIndex | class | describes a skiplist index
|
||||
@SkiplistIndexed | field | describes how to index the field
|
||||
@PersistentIndex | class | describes a persistent index
|
||||
@PersistentIndexed | field | describes how to index the field
|
||||
@GeoIndex | class | describes a geo index
|
||||
@GeoIndexed | field | describes how to index the field
|
||||
@FulltextIndex | class | describes a fulltext index
|
||||
@FulltextIndexed | field | describes how to index the field
|
||||
|
||||
### Document
|
||||
|
||||
The annotations `@Document` applied to a class marks this class as a candidate for mapping to the database. The most relevant parameter is `value` to specify the collection name in the database. The annotation `@Document` specifies the collection type to `DOCUMENT`.
|
||||
|
||||
```java
|
||||
@Document(value="persons")
|
||||
public class Person {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### Edge
|
||||
|
||||
The annotations `@Edge` applied to a class marks this class as a candidate for mapping to the database. The most relevant parameter is `value` to specify the collection name in the database. The annotation `@Edge` specifies the collection type to `EDGE`.
|
||||
|
||||
```java
|
||||
@Edge("relations")
|
||||
public class Relation {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
### 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.
|
||||
|
||||
```java
|
||||
@Document(value="persons")
|
||||
public class Person {
|
||||
@Ref
|
||||
private Address address;
|
||||
}
|
||||
|
||||
@Document("addresses")
|
||||
public class Address {
|
||||
@Id
|
||||
private String id;
|
||||
private String country;
|
||||
private String street;
|
||||
}
|
||||
```
|
||||
|
||||
The database representation of `Person` in collection *persons* looks as follow:
|
||||
|
||||
```
|
||||
{
|
||||
"_key" : "123",
|
||||
"_id" : "persons/123",
|
||||
"address" : "addresses/456"
|
||||
}
|
||||
```
|
||||
and the representation of `Address` in collection *addresses*:
|
||||
```
|
||||
{
|
||||
"_key" : "456",
|
||||
"_id" : "addresses/456",
|
||||
"country" : "...",
|
||||
"street" : "..."
|
||||
}
|
||||
```
|
||||
|
||||
Without the annotation `@Ref` at the field `address`, the stored document would look:
|
||||
|
||||
```
|
||||
{
|
||||
"_key" : "123",
|
||||
"_id" : "persons/123",
|
||||
"address" : {
|
||||
"country" : "...",
|
||||
"street" : "..."
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 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).
|
||||
|
||||
```java
|
||||
@Document(value="persons")
|
||||
public class Person {
|
||||
@Relations(edge=Relation.class, depth=1, direction=Direction.ANY)
|
||||
private List<Person> friends;
|
||||
}
|
||||
|
||||
@Edge(name="relations")
|
||||
public class Relation {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Document with From and To
|
||||
|
||||
With the annotations `@From` and `@To` applied on a collection or array field in a class annotated with `@Document` the nested edge objects are fetched from the database. Each of the nested edge objects has to be stored as separate edge document in the edge collection described in the `@Edge` annotation of the nested object class with the *_id* of the parent document as field *_from* or *_to*.
|
||||
|
||||
```java
|
||||
@Document("persons")
|
||||
public class Person {
|
||||
@From
|
||||
private List<Relation> relations;
|
||||
}
|
||||
|
||||
@Edge(name="relations")
|
||||
public class Relation {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
The database representation of `Person` in collection *persons* looks as follow:
|
||||
```
|
||||
{
|
||||
"_key" : "123",
|
||||
"_id" : "persons/123"
|
||||
}
|
||||
```
|
||||
|
||||
and the representation of `Relation` in collection *relations*:
|
||||
```
|
||||
{
|
||||
"_key" : "456",
|
||||
"_id" : "relations/456",
|
||||
"_from" : "persons/123"
|
||||
"_to" : ".../..."
|
||||
}
|
||||
{
|
||||
"_key" : "789",
|
||||
"_id" : "relations/456",
|
||||
"_from" : "persons/123"
|
||||
"_to" : ".../..."
|
||||
}
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
### Edge with From and To
|
||||
|
||||
With the annotations `@From` and `@To` applied on a field in a class annotated with `@Edge` the nested object is fetched from the database. The nested object has to be stored as a separate document in the collection described in the `@Document` annotation of the nested object class. The *_id* field of this nested object is stored in the fields `_from` or `_to` within the edge document.
|
||||
|
||||
```java
|
||||
@Edge("relations")
|
||||
public class Relation {
|
||||
@From
|
||||
private Person c1;
|
||||
@To
|
||||
private Person c2;
|
||||
}
|
||||
|
||||
@Document(value="persons")
|
||||
public class Person {
|
||||
@Id
|
||||
private String id;
|
||||
}
|
||||
```
|
||||
|
||||
The database representation of `Relation` in collection *relations* looks as follow:
|
||||
```
|
||||
{
|
||||
"_key" : "123",
|
||||
"_id" : "relations/123",
|
||||
"_from" : "persons/456",
|
||||
"_to" : "persons/789"
|
||||
}
|
||||
```
|
||||
|
||||
and the representation of `Person` in collection *persons*:
|
||||
```
|
||||
{
|
||||
"_key" : "456",
|
||||
"_id" : "persons/456",
|
||||
}
|
||||
{
|
||||
"_key" : "789",
|
||||
"_id" : "persons/789",
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** If you want to save an instance of `Relation`, both `Person` objects (from & to) already have to be persisted and the class `Person` needs a field with the annotation `@Id` so it can hold the persisted `_id` from the database.
|
||||
|
||||
### Index and Indexed annotations
|
||||
|
||||
With the `@<IndexType>Indexed` annotations user defined indexes can be created at a collection level by annotating single fields of a class.
|
||||
|
||||
Possible `@<IndexType>Indexed` annotations are:
|
||||
* `@HashIndexed`
|
||||
* `@SkiplistIndexed`
|
||||
* `@PersistentIndexed`
|
||||
* `@GeoIndexed`
|
||||
* `@FulltextIndexed`
|
||||
|
||||
The following example creates a hash index on the field `name` and a separate hash index on the field `age`:
|
||||
```java
|
||||
public class Person {
|
||||
@HashIndexed
|
||||
private String name;
|
||||
|
||||
@HashIndexed
|
||||
private int age;
|
||||
}
|
||||
```
|
||||
|
||||
With the `@<IndexType>Indexed` annotations different indexes can be created on the same field.
|
||||
|
||||
The following example creates a hash index and also a skiplist index on the field `name`:
|
||||
```java
|
||||
public class Person {
|
||||
@HashIndexed
|
||||
@SkiplistIndexed
|
||||
private String name;
|
||||
}
|
||||
```
|
||||
|
||||
If the index should include multiple fields the `@<IndexType>Index` annotations can be used on the type instead.
|
||||
|
||||
Possible `@<IndexType>Index` annotations are:
|
||||
* `@HashIndex`
|
||||
* `@SkiplistIndex`
|
||||
* `@PersistentIndex`
|
||||
* `@GeoIndex`
|
||||
* `@FulltextIndex`
|
||||
|
||||
The following example creates a single hash index on the fields `name` and `age`, note that if a field is renamed in the database with @Field, the new field name must be used in the index declaration:
|
||||
```java
|
||||
@HashIndex(fields = {"fullname", "age"})
|
||||
public class Person {
|
||||
@Field("fullname")
|
||||
private String name;
|
||||
|
||||
private int age;
|
||||
}
|
||||
```
|
||||
|
||||
The `@<IndexType>Index` annotations can also be used to create an index on a nested field.
|
||||
|
||||
The following example creates a single hash index on the fields `name` and `address.country`:
|
||||
```java
|
||||
@HashIndex(fields = {"name", "address.country"})
|
||||
public class Person {
|
||||
private String name;
|
||||
|
||||
private Address address;
|
||||
}
|
||||
```
|
||||
|
||||
The `@<IndexType>Index` annotations and the `@<IndexType>Indexed` annotations can be used at the same time in one class.
|
||||
|
||||
The following example creates a hash index on the fields `name` and `age` and a separate hash index on the field `age`:
|
||||
```java
|
||||
@HashIndex(fields = {"name", "age"})
|
||||
public class Person {
|
||||
private String name;
|
||||
|
||||
@HashIndexed
|
||||
private int age;
|
||||
}
|
||||
```
|
||||
|
||||
The `@<IndexType>Index` annotations can be used multiple times to create more than one index in this way.
|
||||
|
||||
The following example creates a hash index on the fields `name` and `age` and a separate hash index on the fields `name` and `gender`:
|
||||
```java
|
||||
@HashIndex(fields = {"name", "age"})
|
||||
@HashIndex(fields = {"name", "gender"})
|
||||
public class Person {
|
||||
private String name;
|
||||
|
||||
private int age;
|
||||
|
||||
private Gender gender
|
||||
}
|
||||
```
|
|
@ -0,0 +1,55 @@
|
|||
{
|
||||
"gitbook": "^3.2.2",
|
||||
"title": "ArangoDB VERSION_NUMBER AQL Documentation",
|
||||
"author": "ArangoDB GmbH",
|
||||
"description": "Official AQL manual for ArangoDB - the native multi-model NoSQL database",
|
||||
"language": "en",
|
||||
"plugins": [
|
||||
"-search",
|
||||
"-lunr",
|
||||
"-sharing",
|
||||
"toggle-chapters",
|
||||
"addcssjs",
|
||||
"anchorjs",
|
||||
"sitemap-general@git+https://github.com/Simran-B/gitbook-plugin-sitemap-general.git",
|
||||
"ga",
|
||||
"callouts@git+https://github.com/Simran-B/gitbook-plugin-callouts.git",
|
||||
"edit-link",
|
||||
"page-toc@git+https://github.com/Simran-B/gitbook-plugin-page-toc.git",
|
||||
"localized-footer"
|
||||
],
|
||||
"pdf": {
|
||||
"fontSize": 12,
|
||||
"toc": true,
|
||||
"margin": {
|
||||
"right": 60,
|
||||
"left": 60,
|
||||
"top": 35,
|
||||
"bottom": 35
|
||||
}
|
||||
},
|
||||
"styles": {
|
||||
"website": "styles/website.css"
|
||||
},
|
||||
"pluginsConfig": {
|
||||
"addcssjs": {
|
||||
"js": ["styles/header.js", "styles/hs.js"],
|
||||
"css": ["styles/header.css"]
|
||||
},
|
||||
"sitemap-general": {
|
||||
"prefix": "https://docs.arangodb.com/devel/Drivers/",
|
||||
"changefreq": "@GCHANGE_FREQ@",
|
||||
"priority": @GPRIORITY@
|
||||
},
|
||||
"ga": {
|
||||
"token": "UA-81053435-2"
|
||||
},
|
||||
"edit-link": {
|
||||
"base": "https://github.com/arangodb/arangodb/edit/devel/Documentation/Books/Drivers",
|
||||
"label": "Edit Page"
|
||||
},
|
||||
"localized-footer": {
|
||||
"filename": "FOOTER.html"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,292 @@
|
|||
/* Design fix because of the header */
|
||||
@import url(https://fonts.googleapis.com/css?family=Roboto:400,500,300,700);
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
font-family: Roboto, Helvetica, sans-serif;
|
||||
background: #444444;
|
||||
}
|
||||
|
||||
.book .book-header h1 a, .book .book-header h1 a:hover {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* GOOGLE START */
|
||||
|
||||
.google-search #gsc-iw-id1{
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.google-search .gsst_b {
|
||||
position: relative;
|
||||
top: 10px;
|
||||
left: -25px;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.gsst_a .gscb_a {
|
||||
color: #c01a07 !important;
|
||||
}
|
||||
|
||||
.google-search input {
|
||||
background-color: #fff !important;
|
||||
font-family: Roboto, Helvetica, sans-serif;
|
||||
font-size: 10pt !important;
|
||||
padding-left: 5px !important;
|
||||
float: right;
|
||||
position: relative;
|
||||
top: 8px;
|
||||
width: 100% !important;
|
||||
height: 30px !important;
|
||||
}
|
||||
|
||||
.google-search input:active {
|
||||
}
|
||||
|
||||
.google-search {
|
||||
margin-right: 10px;
|
||||
margin-left: 10px !important;
|
||||
float: right !important;
|
||||
}
|
||||
|
||||
.google-search td,
|
||||
.google-search table,
|
||||
.google-search tr,
|
||||
.google-search th {
|
||||
background-color: #444444 !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-input-box,
|
||||
.google-search .gsc-input-box input {
|
||||
border-radius: 3px !important;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.gsc-branding-text,
|
||||
.gsc-branding-img,
|
||||
.gsc-user-defined-text {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-input-box input {
|
||||
font-size: 16px !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-search-button {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-control-cse {
|
||||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.google-search > div {
|
||||
float: left !important;
|
||||
width: 200px !important;
|
||||
}
|
||||
|
||||
/* GOOGLE END */
|
||||
|
||||
.book-summary,
|
||||
.book-body {
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
.arangodb-logo, .arangodb-logo-small {
|
||||
display: inline;
|
||||
float: left;
|
||||
padding-top: 12px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.arangodb-logo img {
|
||||
height: 23px;
|
||||
}
|
||||
|
||||
.arangodb-logo-small {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.arangodb-version-switcher {
|
||||
width: 65px;
|
||||
height: 44px;
|
||||
margin-left: 16px;
|
||||
float: left;
|
||||
display: inline;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color: inherit;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.arangodb-version-switcher option {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
|
||||
.arangodb-header {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
height: 48px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.arangodb-header .socialIcons-googlegroups a img {
|
||||
position: relative;
|
||||
height: 14px;
|
||||
top: 3px;
|
||||
}
|
||||
|
||||
.arangodb-navmenu {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.arangodb-navmenu li {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.arangodb-navmenu li a {
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 0 10px;
|
||||
line-height: 48px;
|
||||
font-size: 16px;
|
||||
font-weight: 400;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-family: Roboto, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
.arangodb-navmenu li.active-tab a, .arangodb-navmenu li a:hover {
|
||||
background-color: #88A049 !important;
|
||||
}
|
||||
|
||||
.downloadIcon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
/** simple responsive updates **/
|
||||
|
||||
@media screen and (max-width: 1000px) {
|
||||
.arangodb-logo {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.google-search {
|
||||
margin-right: 5px !important;
|
||||
}
|
||||
|
||||
.downloadIcon {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.socialIcons {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media screen and (max-width: 800px) {
|
||||
|
||||
.google-search,
|
||||
.google-search .gsc-input-box,
|
||||
.google-search .gsc-input-box input {
|
||||
width: 130px !important;
|
||||
}
|
||||
|
||||
.arangodb-navmenu li a {
|
||||
font-size: 15px;
|
||||
padding: 0 7px;
|
||||
}
|
||||
|
||||
.arangodb-logo {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.arangodb-logo-small {
|
||||
display: inline;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.arangodb-logo-small img {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.arangodb-version-switcher {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 530px) {
|
||||
.arangodb-version-switcher,
|
||||
.downloadIcon {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.google-search,
|
||||
.google-search .gsc-input-box,
|
||||
.google-search .gsc-input-box input {
|
||||
width: 24px !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-input-box input[style] {
|
||||
background: url(https://docs.arangodb.com/assets/searchIcon.png) left center no-repeat rgb(255, 255, 255) !important;
|
||||
}
|
||||
|
||||
.google-search .gsc-input-box input:focus {
|
||||
width: 200px !important;
|
||||
position: relative;
|
||||
left: -176px;
|
||||
background-position: -9999px -9999px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 330px) {
|
||||
.arangodb-logo-small, .google-search {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/*Hubspot Cookie notice */
|
||||
|
||||
body div#hs-eu-cookie-confirmation {
|
||||
bottom: 0;
|
||||
top: auto;
|
||||
position: fixed;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
body div#hs-eu-cookie-confirmation.can-use-gradients {
|
||||
background-image: linear-gradient(to bottom, rgba(255,255,255,0.9),rgba(255,255,255,0.75));
|
||||
}
|
||||
|
||||
body div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner {
|
||||
display: inline-block;
|
||||
padding: 15px 18px 0;
|
||||
}
|
||||
|
||||
body div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner #hs-en-cookie-confirmation-buttons-area {
|
||||
float: left;
|
||||
}
|
||||
|
||||
body div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner a#hs-eu-confirmation-button {
|
||||
background-color: #577138 !important;
|
||||
border: none !important;
|
||||
text-shadow: none !important;
|
||||
box-shadow: none;
|
||||
padding: 5px 15px !important;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
body div#hs-eu-cookie-confirmation div#hs-eu-cookie-confirmation-inner > p {
|
||||
float: left;
|
||||
color: #000 !important;
|
||||
text-shadow: none;
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
// Try to set the version number early, jQuery not available yet
|
||||
var searcheable_versions = [@BROWSEABLE_VERSIONS@];
|
||||
var cx = '@GSEARCH_ID@';
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(event) {
|
||||
if (!gitbook.state.root) return;
|
||||
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
|
||||
var switcher = document.getElementsByClassName("arangodb-version-switcher")[0];
|
||||
if (bookVersion) {
|
||||
switcher.value = bookVersion[1];
|
||||
} else {
|
||||
switcher.style.display = "none";
|
||||
}
|
||||
});
|
||||
|
||||
window.onload = function(){
|
||||
window.localStorage.removeItem(":keyword");
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
function appendHeader() {
|
||||
var VERSION_SELECTOR = ""
|
||||
var i = 0;
|
||||
var prefix;
|
||||
for (i = 0; i < searcheable_versions.length; i++ ) {
|
||||
if (searcheable_versions[i] === 'devel') {
|
||||
prefix = '';
|
||||
} else {
|
||||
prefix = 'v';
|
||||
}
|
||||
VERSION_SELECTOR += '<option value="' +
|
||||
searcheable_versions[i] +
|
||||
'">' + prefix +
|
||||
searcheable_versions[i] +
|
||||
'</option>\n';
|
||||
}
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = '<div class="arangodb-header">\n' +
|
||||
' <div class="arangodb-logo">\n' +
|
||||
' <a href="https://arangodb.com/">\n' +
|
||||
' <img src="https://docs.arangodb.com/assets/arangodb_logo_2016.png">\n' +
|
||||
' </a>\n' +
|
||||
' </div>\n' +
|
||||
' <div class="arangodb-logo-small">\n' +
|
||||
' <a href="https://arangodb.com/">\n' +
|
||||
' <img src="https://docs.arangodb.com/assets/arangodb_logo_small_2016.png">\n' +
|
||||
' </a>\n' +
|
||||
' </div>\n' +
|
||||
' <select class="arangodb-version-switcher">\n' +
|
||||
VERSION_SELECTOR +
|
||||
' </select>\n' +
|
||||
' <div class="google-search">\n' +
|
||||
' <gcse:searchbox-only></gcse:searchbox-only>\n' +
|
||||
' </div>\n' +
|
||||
' <ul class="arangodb-navmenu">\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Manual">Manual</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="AQL">AQL</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="HTTP">HTTP</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Cookbook">Cookbook</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="active-tab">\n' +
|
||||
' <a href="#" data-book="Drivers">Drivers</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="downloadIcon" title="Download">\n' +
|
||||
' <a href="https://www.arangodb.com/download-arangodb-docs" target="_blank">\n' +
|
||||
' <i class="fa fa-download"></i>\n' +
|
||||
' </a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="socialIcons" title="GitHub">\n' +
|
||||
' <a href="https://github.com/ArangoDB/ArangoDB/issues" target="_blank">\n' +
|
||||
' <i class="fa fa-github"></i>\n' +
|
||||
' </a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="socialIcons" title="StackOverflow">\n' +
|
||||
' <a href="http://stackoverflow.com/questions/tagged/arangodb" target="_blank">\n' +
|
||||
' <i class="fa fa-stack-overflow"></i>\n' +
|
||||
' </a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="socialIcons socialIcons-googlegroups" title="Google Groups">\n' +
|
||||
' <a href="https://groups.google.com/forum/#!forum/arangodb" target="_blank">\n' +
|
||||
' <img alt="Google Groups" src="https://docs.arangodb.com/assets/googlegroupsIcon.png" />\n' +
|
||||
' </a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="socialIcons" title="Slack">\n' +
|
||||
' <a href="https://slack.arangodb.com" target="_blank">\n' +
|
||||
' <i class="fa fa-slack"></i>\n' +
|
||||
' </a>\n' +
|
||||
' </li>\n' +
|
||||
' </ul>\n' +
|
||||
'</div>\n';
|
||||
|
||||
$('.book').before(div.innerHTML);
|
||||
|
||||
};
|
||||
|
||||
|
||||
function rerenderNavbar() {
|
||||
$('#header').remove();
|
||||
appendHeader();
|
||||
};
|
||||
|
||||
//render header
|
||||
rerenderNavbar();
|
||||
function addGoogleSrc() {
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//cse.google.com/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
};
|
||||
addGoogleSrc();
|
||||
|
||||
$(".arangodb-navmenu a[data-book]").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
urlSplit.pop(); // e.g. "Manual"
|
||||
window.location.href = urlSplit.join("/") + "/" + e.target.getAttribute("data-book") + "/index.html";
|
||||
});
|
||||
|
||||
// set again using jQuery to accommodate non-standard browsers (*cough* IE *cough*)
|
||||
var bookVersion = gitbook.state.root.match(/\/(\d\.\d(\.\d)?|devel)\//);
|
||||
var switcher = $(".arangodb-version-switcher");
|
||||
if (bookVersion) {
|
||||
switcher.val(bookVersion[1]);
|
||||
} else {
|
||||
switcher.hide();
|
||||
}
|
||||
|
||||
$(".arangodb-version-switcher").on("change", function(e) {
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
var currentBook = urlSplit.pop(); // e.g. "Manual"
|
||||
urlSplit.pop() // e.g. "3.0"
|
||||
if (e.target.value == "2.8") {
|
||||
var legacyMap = {
|
||||
"Manual": "",
|
||||
"AQL": "/Aql",
|
||||
"HTTP": "/HttpApi",
|
||||
"Cookbook": "/Cookbook"
|
||||
};
|
||||
currentBook = legacyMap[currentBook];
|
||||
} else {
|
||||
currentBook = "/" + currentBook;
|
||||
}
|
||||
window.location.href = urlSplit.join("/") + "/" + e.target.value + currentBook + "/index.html";
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
};
|
|
@ -0,0 +1,33 @@
|
|||
// HubSpot Script Loader. Please do not block this resource. See more: http://hubs.ly/H0702_H0
|
||||
|
||||
(function (id, src, attrs) {
|
||||
if (document.getElementById(id)) {
|
||||
try { console.warn('duplicate hubspot script with id: "' + id + '" included on page'); }
|
||||
finally { return; }
|
||||
}
|
||||
var js = document.createElement('script');
|
||||
js.src = src;
|
||||
js.type = 'text/javascript';
|
||||
js.id = id;
|
||||
for (var name in attrs) { if(attrs.hasOwnProperty(name)) { js.setAttribute(name, attrs[name]); } }
|
||||
var e = document.getElementsByTagName('script')[0];
|
||||
e.parentNode.insertBefore(js, e);
|
||||
})('hubspot-messages-loader', 'https://js.usemessages.com/messageswidgetshell.js', {"data-loader":"hs-scriptloader","data-hsjs-portal":2482448,"data-hsjs-env":"prod"});
|
||||
|
||||
(function (id, src) {
|
||||
if (document.getElementById(id)) { return; }
|
||||
var js = document.createElement('script');
|
||||
js.src = src;
|
||||
js.type = 'text/javascript';
|
||||
js.id = id;
|
||||
var e = document.getElementsByTagName('script')[0];
|
||||
e.parentNode.insertBefore(js, e);
|
||||
})('hs-analytics', '//js.hs-analytics.net/analytics/1508760300000/2482448.js');
|
||||
|
||||
window.setTimeout(function () {
|
||||
$('body').on('click', 'a', function () {
|
||||
var _hsq = window._hsq = window._hsq || [];
|
||||
_hsq.push(['setPath', window.location.pathname]);
|
||||
_hsq.push(['trackPageView']);
|
||||
});
|
||||
}, 1000);
|
|
@ -0,0 +1,55 @@
|
|||
div.example_show_button {
|
||||
border: medium solid lightgray;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
top: -10px;
|
||||
}
|
||||
|
||||
.book .book-body .navigation.navigation-next {
|
||||
right: 10px !important;
|
||||
}
|
||||
|
||||
.book .book-summary ul.summary li.active>a,.book .book-summary ul.summary li a:hover {
|
||||
color: #fff !important;
|
||||
background: #80A54D !important;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.book .book-body .page-wrapper .page-inner section.normal .deprecated{
|
||||
background-color: rgba(240,240,0,0.4);
|
||||
}
|
||||
|
||||
.book .book-body section > ul li:last-child {
|
||||
margin-bottom: 0.85em;
|
||||
}
|
||||
|
||||
.book .book-body .alert p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.columns-3 {
|
||||
-webkit-column-count: 3;
|
||||
-moz-column-count: 3;
|
||||
-ms-column-count: 3;
|
||||
-o-column-count: 3;
|
||||
column-count: 3;
|
||||
columns: 3;
|
||||
}
|
||||
|
||||
.localized-footer {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.gsib_a {
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
.gsc-control-cse {
|
||||
border: 0px !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
|
||||
.gsc-input {
|
||||
margin: 0px !important;
|
||||
}
|
|
@ -65,6 +65,9 @@ function appendHeader() {
|
|||
' <li>\n' +
|
||||
' <a href="#" data-book="Cookbook">Cookbook</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Drivers">Drivers</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="downloadIcon" title="Download">\n' +
|
||||
' <a href="https://www.arangodb.com/download-arangodb-docs" target="_blank">\n' +
|
||||
' <i class="fa fa-download"></i>\n' +
|
||||
|
@ -116,7 +119,7 @@ function appendHeader() {
|
|||
};
|
||||
addGoogleSrc();
|
||||
|
||||
$(".arangodb-navmenu a:lt(4)").on("click", function(e) {
|
||||
$(".arangodb-navmenu a[data-book]").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
|
|
|
@ -86,8 +86,8 @@ use the load command:
|
|||
require("internal").load("/tmp/test.js") // <- Linux / MacOS
|
||||
require("internal").load("c:\\tmp\\test.js") // <- Windows
|
||||
|
||||
Exiting arangosh can be done using the key combination ```<CTRL> + D``` or by
|
||||
typing ```quit<CR>```
|
||||
Exiting arangosh can be done using the key combination `<CTRL> + D` or by
|
||||
typing `quit<CR>`
|
||||
|
||||
Escaping
|
||||
--------
|
||||
|
|
|
@ -12,7 +12,10 @@ to the [Datacenter to datacenter replication](../Scalability/DC2DC/README.md) ch
|
|||
Deployment steps:
|
||||
|
||||
- [Cluster](DC2DC/Cluster.md)
|
||||
- [Kafka & Zookeeper](DC2DC/KafkaZookeeper.md)
|
||||
- [ArangoSync Master](DC2DC/ArangoSyncMaster.md)
|
||||
- [ArangoSync Workers](DC2DC/ArangoSyncWorkers.md)
|
||||
- [Prometheus & Grafana (optional)](DC2DC/PrometheusGrafana.md)
|
||||
|
||||
When using the `kafka` type message queue, you also have to deploy:
|
||||
|
||||
- [Kafka & Zookeeper](DC2DC/KafkaZookeeper.md)
|
||||
|
|
|
@ -30,19 +30,26 @@ ExecStart=/usr/sbin/arangosync run master \
|
|||
--cluster.jwtSecret=${CLUSTERSECRET} \
|
||||
--server.keyfile=${CERTIFICATEDIR}/tls.keyfile \
|
||||
--server.client-cafile=${CERTIFICATEDIR}/client-auth-ca.crt \
|
||||
--server.endpoint=https://${PUBLICIP}:${MASTERPORT} \
|
||||
--server.endpoint=https://${PRIVATEIP}:${MASTERPORT} \
|
||||
--server.port=${MASTERPORT} \
|
||||
--master.endpoint=${PUBLICMASTERENDPOINTS} \
|
||||
--master.jwtSecret=${MASTERSECRET} \
|
||||
--mq.type=kafka \
|
||||
--mq.kafka-addr=${KAFKAENDPOINTS} \
|
||||
--mq.kafka-client-keyfile=${CERTIFICATEDIR}/kafka-client.key \
|
||||
--mq.kafka-cacert=${CERTIFICATEDIR}/tls-ca.crt \
|
||||
--mq.type=direct
|
||||
TimeoutStopSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
When using the `kafka` type message queue, replace `--mq.type=direct` with `--mq.type=kafka`
|
||||
and add the following arguments.
|
||||
|
||||
```text
|
||||
--mq.kafka-addr=${KAFKAENDPOINTS} \
|
||||
--mq.kafka-client-keyfile=${CERTIFICATEDIR}/kafka-client.key \
|
||||
--mq.kafka-cacert=${CERTIFICATEDIR}/tls-ca.crt
|
||||
```
|
||||
|
||||
The _sync master_ needs a TLS server certificate and a
|
||||
If you want the service to create a TLS certificate & client authentication
|
||||
certificate, for authenticating with _ArangoSync Masters_ in another datacenter,
|
||||
|
@ -56,7 +63,8 @@ ExecStartPre=/usr/sbin/arangosync create tls keyfile \
|
|||
--keyfile=${CERTIFICATEDIR}/tls.keyfile \
|
||||
--host=${PUBLICIP} \
|
||||
--host=${PRIVATEIP} \
|
||||
--host=${HOST}
|
||||
--host=${HOST} \
|
||||
--host=${CLUSTERDNSNAME}
|
||||
ExecStartPre=/usr/sbin/arangosync create client-auth keyfile \
|
||||
--cacert=${CERTIFICATEDIR}/tls-ca.crt \
|
||||
--cakey=${CERTIFICATEDIR}/tls-ca.key \
|
||||
|
@ -70,6 +78,11 @@ The _ArangoSync Master_ must be reachable on a TCP port `${MASTERPORT}` (used wi
|
|||
This port must be reachable from inside the datacenter (by sync workers and operations)
|
||||
and from inside of the other datacenter (by sync masters in the other datacenter).
|
||||
|
||||
Note that other sync masters in the same datacenter will contact this sync master
|
||||
through the endpoint specified in `--server.endpoint`.
|
||||
Sync masters (&sync workers) from the other datacenter will contains this sync master
|
||||
through the endpoint specified in `--master.endpoint`.
|
||||
|
||||
## Recommended deployment environment
|
||||
|
||||
Since the _sync masters_ can be CPU intensive when running lots of databases & collections,
|
||||
|
|
|
@ -52,10 +52,10 @@ Below you'll find all settings of the `ArangoDeployment` custom resource.
|
|||
Several settings are for various groups of servers. These are indicated
|
||||
with `<group>` where `<group>` can be any of:
|
||||
|
||||
- `agents` for all agents of a `Cluster` or `ResilientSingle` pair.
|
||||
- `agents` for all agents of a `Cluster` or `ActiveFailover` pair.
|
||||
- `dbservers` for all dbservers of a `Cluster`.
|
||||
- `coordinators` for all coordinators of a `Cluster`.
|
||||
- `single` for all single servers of a `Single` instance or `ResilientSingle` pair.
|
||||
- `single` for all single servers of a `Single` instance or `ActiveFailover` pair.
|
||||
- `syncmasters` for all syncmasters of a `Cluster`.
|
||||
- `syncworkers` for all syncworkers of a `Cluster`.
|
||||
|
||||
|
@ -65,7 +65,7 @@ This setting specifies the type of deployment you want to create.
|
|||
Possible values are:
|
||||
|
||||
- `Cluster` (default) Full cluster. Defaults to 3 agents, 3 dbservers & 3 coordinators.
|
||||
- `ResilientSingle` Resilient single pair. Defaults to 3 agents and 2 single servers.
|
||||
- `ActiveFailover` Active-failover single pair. Defaults to 3 agents and 2 single servers.
|
||||
- `Single` Single server only (note this does not provide high availability or reliability).
|
||||
|
||||
This setting cannot be changed after the deployment has been created.
|
||||
|
@ -255,7 +255,7 @@ The default is `false`.
|
|||
This setting specifies the number of servers to start for the given group.
|
||||
For the agent group, this value must be a positive, odd number.
|
||||
The default value is `3` for all groups except `single` (there the default is `1`
|
||||
for `spec.mode: single` and `2` for `spec.mode: resilientsingle`).
|
||||
for `spec.mode: Single` and `2` for `spec.mode: ActiveFailover`).
|
||||
|
||||
For the `syncworkers` group, it is highly recommended to use the same number
|
||||
as for the `dbservers` group.
|
||||
|
|
|
@ -35,11 +35,11 @@ E.g. these are valid arguments.
|
|||
Start a local (test) cluster. Since all servers are running on a single machine
|
||||
this is really not intended for production setups.
|
||||
|
||||
- `--starter.mode=cluster|single|resilientsingle`
|
||||
- `--starter.mode=cluster|single|activefailover`
|
||||
|
||||
Select what kind of database configuration you want.
|
||||
This can be a `cluster` configuration (which is the default),
|
||||
a `single` server configuration or a `resilientsingle` configuration with
|
||||
a `single` server configuration or a `activefailover` configuration with
|
||||
2 single services configured to take over when needed.
|
||||
|
||||
Note that when running a `single` server configuration you will lose all
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
* [Introduction](Scalability/DC2DC/Introduction.md)
|
||||
* [Applicability](Scalability/DC2DC/Applicability.md)
|
||||
* [Requirements](Scalability/DC2DC/Requirements.md)
|
||||
* [Limitations](Scalability/DC2DC/Limitations.md)
|
||||
|
||||
## OPERATIONS
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb/arangosync.git / docs/Manual/ -->
|
||||
Limitations
|
||||
===========
|
||||
|
||||
The _datacenter to datacenter replication_ setup in ArangoDB has a few limitations.
|
||||
Some of these limitations may be removed in later versions of ArangoDB:
|
||||
|
||||
- All the machines where the ArangoDB Server processes run must run the Linux operating system using the AMD64 architecture.
|
||||
Clients can run from any platform.
|
||||
- All the machines where the ArangoSync Server processes run must run the Linux operating system using the AMD64 architecture.
|
||||
The ArangoSync command line tools is available for Linux, Windows & MacOS.
|
||||
- The entire cluster is replicated. It is not possible to exclude specific databases or collections from replication.
|
|
@ -7,13 +7,16 @@ To use _datacenter to datacenter replication_ you need the following:
|
|||
- A network connection between both datacenters with accessible endpoints
|
||||
for several components (see individual components for details).
|
||||
- TLS certificates for ArangoSync master instances (can be self-signed).
|
||||
- TLS certificates for Kafka brokers (can be self-signed).
|
||||
- Optional (but recommended) TLS certificates for ArangoDB clusters (can be self-signed).
|
||||
- Client certificates CA for _ArangoSync masters_ (typically self-signed).
|
||||
- Client certificates for _ArangoSync masters_ (typically self-signed).
|
||||
- At least 2 instances of the _ArangoSync master_ in each datacenter.
|
||||
- One instances of the _ArangoSync worker_ on every machine in each datacenter.
|
||||
|
||||
When using the `kafka` type message queue, you also need:
|
||||
|
||||
- TLS certificates for Kafka brokers (can be self-signed).
|
||||
|
||||
Note: In several places you will need a (x509) certificate.
|
||||
<br/>The [Certificates](../../Security/DC2DC/README.md#certificates) section provides more guidance for creating
|
||||
and renewing these certificates.
|
||||
|
|
|
@ -17,7 +17,7 @@ Below you'll find an overview of these connections and the TCP ports that should
|
|||
within the same datacenter:
|
||||
|
||||
- ArangoDB agents and coordinators (default ports: `8531` and `8529`)
|
||||
- Kafka brokers (default port `9092`)
|
||||
- Kafka brokers (only when using `kafka` type message queue) (default port `9092`)
|
||||
- Sync workers (default port `8729`)
|
||||
|
||||
Additionally the sync masters must be allowed to connect to the sync masters in the other datacenter.
|
||||
|
@ -27,14 +27,15 @@ Below you'll find an overview of these connections and the TCP ports that should
|
|||
1. The sync workers must be allowed to connect to the following components within the same datacenter:
|
||||
|
||||
- ArangoDB coordinators (default port `8529`)
|
||||
- Kafka brokers (default port `9092`)
|
||||
- Kafka brokers (only when using `kafka` type message queue) (default port `9092`)
|
||||
- Sync masters (default port `8629`)
|
||||
|
||||
By default the sync workers will operate on port `8729`.
|
||||
|
||||
Additionally the sync workers must be allowed to connect to the Kafka brokers in the other datacenter.
|
||||
Additionally (when using `kafka` type message queue) the sync workers must be allowed to
|
||||
connect to the Kafka brokers in the other datacenter.
|
||||
|
||||
1. Kafka
|
||||
1. Kafka (when using `kafka` type message queue)
|
||||
|
||||
The kafka brokers must be allowed to connect to the following components within the same datacenter:
|
||||
|
||||
|
@ -45,7 +46,7 @@ Below you'll find an overview of these connections and the TCP ports that should
|
|||
metrics on port `7071`. To gain more insight into kafka open this port for your prometheus
|
||||
installation.
|
||||
|
||||
1. Zookeeper
|
||||
1. Zookeeper (when using `kafka` type message queue)
|
||||
|
||||
The zookeeper agents must be allowed to connect to the following components within the same datacenter:
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@ Besides the above list, you probably want to use the following:
|
|||
## Deployment
|
||||
|
||||
In the following paragraphs you'll learn which components have to be deployed
|
||||
for datacenter to datacenter replication. For detailed deployment instructions,
|
||||
for datacenter to datacenter replication using the `direct` message queue.
|
||||
For detailed deployment instructions or instructions for the `kafka` message queue,
|
||||
consult the [reference manual](../../Deployment/DC2DC.md).
|
||||
|
||||
### ArangoDB cluster
|
||||
|
@ -104,15 +105,6 @@ it is recommended to run agents on dedicated machines. Consider these machines "
|
|||
|
||||
Coordinators and dbservers can be deployed of other machines that should be considered "cattle".
|
||||
|
||||
### Kafka & Zookeeper
|
||||
|
||||
Kafka & Zookeeper are needed when using the `kafka` type message queue.
|
||||
|
||||
Since the kafka brokers are really CPU and memory intensive,
|
||||
it is recommended to run zookeeper & kakfa on dedicated machines.
|
||||
|
||||
Consider these machines "pets".
|
||||
|
||||
### Sync Master
|
||||
|
||||
The Sync Master is responsible for managing all synchronization, creating tasks and assigning
|
||||
|
@ -149,13 +141,6 @@ down for a restart.
|
|||
|
||||
The sync worker must be reachable on a TCP port 8729 (default).
|
||||
This port must be reachable from inside the datacenter (by sync masters).
|
||||
When using the `direct` message queue type, this port must also be reachable from
|
||||
the other datacenter.
|
||||
|
||||
Note the large file descriptor limit when using the `kafka` message queue type.
|
||||
With kafka, the sync worker requires about 30 file descriptors per shard.
|
||||
If you use hardware with huge resources, and still run out of file descriptors,
|
||||
you can decide to run multiple sync workers on each machine in order to spread the tasks across them.
|
||||
|
||||
The sync workers should be run on all machines that also contain an ArangoDB dbserver.
|
||||
The sync worker can be memory intensive when running lots of databases & collections.
|
||||
|
@ -283,12 +268,6 @@ Below you'll find an overview per component.
|
|||
E.g. `--log.output=file://myLogFile` or `--log.level=info`.
|
||||
- A statistics API `GET /_admin/statistics`
|
||||
|
||||
- Kafka cluster: The kafka brokers provide:
|
||||
- A log file, see settings with `log.` prefix in its `server.properties` configuration file.
|
||||
|
||||
- Zookeeper: The zookeeper agents provide:
|
||||
- A log on standard output.
|
||||
|
||||
### What to look for while monitoring status
|
||||
|
||||
The very first thing to do when monitoring the status of ArangoSync is to
|
||||
|
@ -360,7 +339,7 @@ target & lifetime.
|
|||
<br/> A certificate created for client authentication (function) cannot be used as a TLS server certificate
|
||||
(same is true for the reverse).
|
||||
<br/> A certificate for host `myserver` (target) cannot be used for host `anotherserver`.
|
||||
<br/> A certficiate that is valid until October 2017 (limetime) cannot be used after October 2017.
|
||||
<br/> A certificate that is valid until October 2017 (limetime) cannot be used after October 2017.
|
||||
|
||||
If anything changes in function, target or lifetime you need a new certificate.
|
||||
|
||||
|
|
|
@ -195,12 +195,12 @@ docker run -it --name=adb --rm -p 8528:8528 \
|
|||
|
||||
## Starting a resilient single server pair
|
||||
|
||||
If you want to start a resilient single database server, use `--starter.mode=resilientsingle`.
|
||||
If you want to start a resilient single database server, use `--starter.mode=activefailover`.
|
||||
In this mode a 3 machine agency is started and 2 single servers that perform
|
||||
asynchronous replication an failover if needed.
|
||||
|
||||
```bash
|
||||
arangodb --starter.mode=resilientsingle --starter.join A,B,C
|
||||
arangodb --starter.mode=activefailover --starter.join A,B,C
|
||||
```
|
||||
|
||||
Run this on machine A, B & C.
|
||||
|
@ -213,7 +213,7 @@ instance should NOT be scheduled.
|
|||
## Starting a resilient single server pair in Docker
|
||||
|
||||
If you want to start a resilient single database server running in docker containers,
|
||||
use the normal docker arguments, combined with `--starter.mode=resilientsingle`.
|
||||
use the normal docker arguments, combined with `--starter.mode=activefailover`.
|
||||
|
||||
```bash
|
||||
export IP=<IP of docker host>
|
||||
|
@ -223,7 +223,7 @@ docker run -it --name=adb --rm -p 8528:8528 \
|
|||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
arangodb/arangodb-starter \
|
||||
--starter.address=$IP \
|
||||
--starter.mode=resilientsingle \
|
||||
--starter.mode=activefailover \
|
||||
--starter.join=A,B,C
|
||||
```
|
||||
|
||||
|
@ -240,7 +240,7 @@ If you want to start a local resilient server pair quickly, use the `--starter.l
|
|||
It will start all servers within the context of a single starter process.
|
||||
|
||||
```bash
|
||||
arangodb --starter.local --starter.mode=resilientsingle
|
||||
arangodb --starter.local --starter.mode=activefailover
|
||||
```
|
||||
|
||||
Note: When you restart the started, it remembers the original `--starter.local` flag.
|
||||
|
|
|
@ -65,6 +65,9 @@ function appendHeader() {
|
|||
' <li>\n' +
|
||||
' <a href="#" data-book="Cookbook">Cookbook</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li>\n' +
|
||||
' <a href="#" data-book="Drivers">Drivers</a>\n' +
|
||||
' </li>\n' +
|
||||
' <li class="downloadIcon" title="Download">\n' +
|
||||
' <a href="https://www.arangodb.com/download-arangodb-docs" target="_blank">\n' +
|
||||
' <i class="fa fa-download"></i>\n' +
|
||||
|
@ -116,7 +119,7 @@ function appendHeader() {
|
|||
};
|
||||
addGoogleSrc();
|
||||
|
||||
$(".arangodb-navmenu a:lt(4)").on("click", function(e) {
|
||||
$(".arangodb-navmenu a[data-book]").on("click", function(e) {
|
||||
e.preventDefault();
|
||||
var urlSplit = gitbook.state.root.split("/");
|
||||
urlSplit.pop(); // ""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
ALLBOOKS="HTTP AQL Manual Cookbook"
|
||||
ALLBOOKS="HTTP AQL Manual Cookbook Drivers"
|
||||
OTHER_MIME="pdf epub mobi"
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
|
@ -106,7 +106,7 @@ function book-check-restheader-leftovers()
|
|||
{
|
||||
NAME="$1"
|
||||
echo "${STD_COLOR}##### checking for restheader leftovers in ${NAME}${RESET}"
|
||||
ERRORS=$(find "ppbooks/${NAME}" -name "*.md" -exec grep -- '^@[A-Z]*' {} \; -print)
|
||||
ERRORS=$(find "ppbooks/${NAME}" -not \( -path "ppbooks/Drivers/SpringData/*" -prune \) -name "*.md" -exec grep -- '^@[A-Z]*' {} \; -print)
|
||||
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
|
||||
echo "${ERR_COLOR}"
|
||||
echo "found these unconverted Swagger Restapi tags: "
|
||||
|
@ -218,7 +218,7 @@ function book-check-markdown-leftovers()
|
|||
fi
|
||||
|
||||
set +e
|
||||
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\.md\"[ />]' {} \; -print | grep -v data-filepath)
|
||||
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '"[a-zA-Z/\.]*\.md\"[ />]' {} \; -print | grep -v data-filepath)
|
||||
set -e
|
||||
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
|
||||
echo "${ERR_COLOR}"
|
||||
|
@ -229,7 +229,7 @@ function book-check-markdown-leftovers()
|
|||
fi
|
||||
|
||||
set +e
|
||||
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '\.md#' {} \; -print)
|
||||
ERRORS=$(find "books/${NAME}" -name '*.html' -exec grep '"[a-zA-Z/\.]*\.md#' {} \; -print)
|
||||
set -e
|
||||
if test "$(echo -n "${ERRORS}" | wc -l)" -gt 0; then
|
||||
echo "${ERR_COLOR}"
|
||||
|
|
|
@ -11,13 +11,15 @@ searchMDPaths = [
|
|||
"Manual",
|
||||
"AQL",
|
||||
"HTTP",
|
||||
"Cookbook"
|
||||
"Cookbook",
|
||||
"Drivers"
|
||||
]
|
||||
searchPaths = [
|
||||
"Documentation/Books/Manual/",
|
||||
"Documentation/Books/AQL/",
|
||||
"Documentation/Books/HTTP/",
|
||||
"Documentation/Books/Cookbook/",
|
||||
"Documentation/Books/Drivers/",
|
||||
"Documentation/DocuBlocks/"
|
||||
]
|
||||
fullSuccess = True
|
||||
|
@ -41,7 +43,8 @@ def file_content(filepath):
|
|||
(not searchMDPaths[0] in filepath) and
|
||||
(not searchMDPaths[1] in filepath) and
|
||||
(not searchMDPaths[2] in filepath) and
|
||||
(not searchMDPaths[3] in filepath)):
|
||||
(not searchMDPaths[3] in filepath) and
|
||||
(not searchMDPaths[4] in filepath)):
|
||||
print "next startDocuBlock found without endDocuBlock inbetween in file %s [%s]" %(filepath, line)
|
||||
raise
|
||||
_start = line[0]
|
||||
|
@ -137,23 +140,23 @@ def example_content(filepath, fh, tag, blockType, placeIntoFilePath):
|
|||
|
||||
if blockType == "AQL":
|
||||
if line.startswith("@Q"): # query part
|
||||
blockCount = 0;
|
||||
blockCount = 0
|
||||
aqlState = AQL_STATE_QUERY
|
||||
short += "<strong>Query:</strong>\n<pre>\n"
|
||||
longText += "<strong>Query:</strong>\n<pre>\n"
|
||||
continue # skip this line - its only here for this.
|
||||
continue # skip this line - it is only here for this.
|
||||
elif line.startswith("@B"): # bind values part
|
||||
short += "</pre>\n<strong>Bind Values:</strong>\n<pre>\n"
|
||||
longText += "</pre>\n<strong>Bind Values:</strong>\n<pre>\n"
|
||||
blockCount = 0;
|
||||
blockCount = 0
|
||||
aqlState = AQL_STATE_BINDV
|
||||
continue # skip this line - its only here for this.
|
||||
continue # skip this line - it is only here for this.
|
||||
elif line.startswith("@R"): # result part
|
||||
shortable = True
|
||||
longText += "</pre>\n<strong>Results:</strong>\n<pre>\n"
|
||||
blockCount = 0;
|
||||
blockCount = 0
|
||||
aqlState = AQL_STATE_RESULT
|
||||
continue # skip this line - its only here for this.
|
||||
continue # skip this line - it is only here for this.
|
||||
|
||||
if aqlState == AQL_STATE_QUERY or aqlState == AQL_STATE_BINDV:
|
||||
short = short + line
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ALLBOOKS="HTTP AQL Manual Cookbook"
|
||||
ALLBOOKS="HTTP AQL Manual Cookbook Drivers"
|
||||
|
||||
GITAUTH="$1"
|
||||
|
||||
|
@ -29,6 +30,17 @@ for book in ${ALLBOOKS}; do
|
|||
git clone "${AUTHREPO}" "${CODIR}"
|
||||
fi
|
||||
|
||||
# extract branch/tag/... for checkout from VERSIONS file
|
||||
branch=$(cat ../../VERSIONS|grep "EXTERNAL_DOC_${CLONEDIR}=" | sed "s/^EXTERNAL_DOC_${CLONEDIR}=//")
|
||||
|
||||
if [ -z "${branch}" ]; then
|
||||
echo "no branch for ${CLONEDIR}, specify in VERSIONS file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# checkout name from VERSIONS file and pull=merge origin
|
||||
(cd "${CODIR}" && git checkout "${branch}" && git pull)
|
||||
|
||||
for oneMD in $(cd "${CODIR}/${SUBDIR}"; find "./${SRC}" -type f |sed "s;\./;;"); do
|
||||
export oneMD
|
||||
export NAME=$(basename ${oneMD})
|
||||
|
|
7
VERSIONS
7
VERSIONS
|
@ -3,7 +3,14 @@ SYNCER_REV "latest"
|
|||
GSEARCH_ID_HTTP "010085642145132923492:fixi4yzeiz8"
|
||||
GSEARCH_ID_AQL "010085642145132923492:6ymjhhr677k"
|
||||
GSEARCH_ID_Manual "010085642145132923492:djexw6vlsgo"
|
||||
GSEARCH_ID_Drivers "010085642145132923492:j_mijzclede"
|
||||
GSEARCH_ID_Cookbook "010085642145132923492:nknyifjn7tu"
|
||||
GCHANGE_FREQ "daily"
|
||||
GPRIORITY "0.3"
|
||||
BROWSEABLE_VERSIONS "'devel', '3.3', '3.2', '3.1', '3.0', '2.8'"
|
||||
EXTERNAL_DOC_arangodb-java-driver=master
|
||||
EXTERNAL_DOC_arangodbjs=master
|
||||
EXTERNAL_DOC_arangosync=master
|
||||
EXTERNAL_DOC_arangodb=master
|
||||
EXTERNAL_DOC_spring-data=master
|
||||
EXTERNAL_DOC_kube-arangodb=master
|
||||
|
|
Loading…
Reference in New Issue