mirror of https://gitee.com/bigwinds/arangodb
Doc - sync from external repos (#5889)
This commit is contained in:
parent
e512ad98ef
commit
d0aeff6db3
|
@ -11,11 +11,11 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
|
||||
**Arguments**
|
||||
|
||||
* **config**: `Object` (optional)
|
||||
- **config**: `Object` (optional)
|
||||
|
||||
An object with the following properties:
|
||||
|
||||
* **url**: `string | Array<string>` (Default: `http://localhost:8529`)
|
||||
- **url**: `string | Array<string>` (Default: `http://localhost:8529`)
|
||||
|
||||
Base URL of the ArangoDB server or list of server URLs.
|
||||
|
||||
|
@ -37,14 +37,14 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
}
|
||||
```
|
||||
|
||||
* **isAbsolute**: `boolean` (Default: `false`)
|
||||
- **isAbsolute**: `boolean` (Default: `false`)
|
||||
|
||||
If this option is explicitly set to `true`, the _url_ will be treated as the
|
||||
absolute database path. This is an escape hatch to allow using arangojs with
|
||||
database APIs exposed with a reverse proxy and makes it impossible to switch
|
||||
databases with _useDatabase_ or using _acquireHostList_.
|
||||
|
||||
* **arangoVersion**: `number` (Default: `30000`)
|
||||
- **arangoVersion**: `number` (Default: `30000`)
|
||||
|
||||
Value of the `x-arango-version` header. This should match the lowest
|
||||
version of ArangoDB you expect to be using. The format is defined as
|
||||
|
@ -58,14 +58,14 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
not available on every major version of ArangoDB as indicated in their
|
||||
descriptions below (e.g. _collection.first_, _collection.bulkUpdate_).
|
||||
|
||||
* **headers**: `Object` (optional)
|
||||
- **headers**: `Object` (optional)
|
||||
|
||||
An object with additional headers to send with every request.
|
||||
|
||||
Header names should always be lowercase. If an `"authorization"` header is
|
||||
provided, it will be overridden when using _useBasicAuth_ or _useBearerAuth_.
|
||||
|
||||
* **agent**: `Agent` (optional)
|
||||
- **agent**: `Agent` (optional)
|
||||
|
||||
An http Agent instance to use for connections.
|
||||
|
||||
|
@ -75,7 +75,7 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
|
||||
This option has no effect when using the browser version of arangojs.
|
||||
|
||||
* **agentOptions**: `Object` (Default: see below)
|
||||
- **agentOptions**: `Object` (Default: see below)
|
||||
|
||||
An object with options for the agent. This will be ignored if _agent_ is
|
||||
also provided.
|
||||
|
@ -92,15 +92,41 @@ If _config_ is a string, it will be interpreted as _config.url_.
|
|||
additional options to the underlying calls of the
|
||||
[`xhr`](https://www.npmjs.com/package/xhr) module.
|
||||
|
||||
* **loadBalancingStrategy**: `string` (Default: `"NONE"`)
|
||||
- **loadBalancingStrategy**: `string` (Default: `"NONE"`)
|
||||
|
||||
Determines the behaviour when multiple URLs are provided:
|
||||
Determines the behavior when multiple URLs are provided:
|
||||
|
||||
* `NONE`: No load balancing. All requests will be handled by the first
|
||||
- `NONE`: No load balancing. All requests will be handled by the first
|
||||
URL in the list until a network error is encountered. On network error,
|
||||
arangojs will advance to using the next URL in the list.
|
||||
|
||||
* `ONE_RANDOM`: Randomly picks one URL from the list initially, then
|
||||
- `ONE_RANDOM`: Randomly picks one URL from the list initially, then
|
||||
behaves like `NONE`.
|
||||
|
||||
* `ROUND_ROBIN`: Every sequential request uses the next URL in the list.
|
||||
- `ROUND_ROBIN`: Every sequential request uses the next URL in the list.
|
||||
|
||||
## database.close
|
||||
|
||||
`database.close(): void`
|
||||
|
||||
Closes all active connections of the database instance.
|
||||
Can be used to clean up idling connections during longer periods of inactivity.
|
||||
|
||||
**Note**: This method currently has no effect in the browser version of arangojs.
|
||||
|
||||
**Examples**
|
||||
|
||||
```js
|
||||
const db = new Database();
|
||||
const sessions = db.collection("sessions");
|
||||
// Clean up expired sessions once per hour
|
||||
setInterval(async () => {
|
||||
await db.query(aql`
|
||||
FOR session IN ${sessions}
|
||||
FILTER session.expires < DATE_NOW()
|
||||
REMOVE session IN ${sessions}
|
||||
`);
|
||||
// Make sure to close the connections because they're no longer used
|
||||
db.close();
|
||||
}, 1000 * 60 * 60);
|
||||
```
|
||||
|
|
|
@ -7,7 +7,7 @@ _ArangoCursor_ instances provide an abstraction over the HTTP API's limitations.
|
|||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", null, null, Integer.class);
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class);
|
||||
// query result list: [1, 2, 3, 4, 5]
|
||||
Integer value = cursor.next();
|
||||
assertThat(value, is(1));
|
||||
|
@ -22,6 +22,16 @@ ArangoCursor.hasNext() : boolean
|
|||
|
||||
Returns _true_ if the cursor has more elements in its current batch of results or the cursor on the server has more batches.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
boolean hasNext = cursor.hasNext();
|
||||
```
|
||||
|
||||
## ArangoCursor.next
|
||||
|
||||
```
|
||||
|
@ -30,6 +40,213 @@ ArangoCursor.next() : T
|
|||
|
||||
Returns the next element of the query result. If the current element is the last element of the batch and the cursor on the server provides more batches, the next batch is fetched from the server.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Integer value = cursor.next();
|
||||
assertThat(value, is(1));
|
||||
```
|
||||
|
||||
## ArangoCursor.first
|
||||
|
||||
```
|
||||
ArangoCursor.first() : T
|
||||
```
|
||||
|
||||
Returns the first element or {@code null} if no element exists.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("RETURN 1", Integer.class)
|
||||
Integer value = cursor.first();
|
||||
assertThat(value, is(1));
|
||||
```
|
||||
|
||||
## ArangoCursor.foreach
|
||||
|
||||
```
|
||||
ArangoCursor.foreach(Consumer<? super T> action) : void
|
||||
```
|
||||
|
||||
Performs the given action for each element of the _ArangoIterable_
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **action**: `Consumer<? super T>`
|
||||
|
||||
A action to perform on the elements
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
cursor.foreach(e -> {
|
||||
// remaining results: [1, 2, 3, 4, 5]
|
||||
});
|
||||
```
|
||||
|
||||
## ArangoCursor.map
|
||||
|
||||
```
|
||||
ArangoCursor.map(Function<? super T, ? extends R> mapper) : ArangoIterable<R>
|
||||
```
|
||||
|
||||
Returns a _ArangoIterable_ consisting of the results of applying the given function to the elements of this _ArangoIterable_.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **mapper**: `Function<? super T, ? extends R>`
|
||||
|
||||
A function to apply to each element
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
cursor.map(e -> e * 10).foreach(e -> {
|
||||
// remaining results: [10, 20, 30, 40, 50]
|
||||
});
|
||||
```
|
||||
|
||||
## ArangoCursor.filter
|
||||
|
||||
```
|
||||
ArangoCursor.filter(Predicate<? super T> predicate) : ArangoIterable<T>
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **predicate**: `Predicate<? super T>`
|
||||
|
||||
A predicate to apply to each element to determine if it should be included
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
cursor.filter(e -> e < 4).foreach(e -> {
|
||||
// remaining results: [1, 2, 3]
|
||||
});
|
||||
```
|
||||
|
||||
## ArangoCursor.anyMatch
|
||||
|
||||
```
|
||||
ArangoCursor.anyMatch(Predicate<? super T> predicate) : boolean
|
||||
```
|
||||
|
||||
Returns whether any elements of this _ArangoIterable_ match the provided predicate.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **predicate**: `Predicate<? super T>`
|
||||
|
||||
A predicate to apply to elements of this {@code ArangoIterable}
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
boolean match = cursor.anyMatch(e -> e == 3);
|
||||
assertThat(match, is(true));
|
||||
```
|
||||
|
||||
## ArangoCursor.allMatch
|
||||
|
||||
```
|
||||
ArangoCursor.anyMatch(Predicate<? super T> predicate) : boolean
|
||||
```
|
||||
|
||||
Returns whether all elements of this _ArangoIterable_ match the provided predicate.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **predicate**: `Predicate<? super T>`
|
||||
|
||||
A predicate to apply to elements of this {@code ArangoIterable}
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
boolean match = cursor.allMatch(e -> e <= 5);
|
||||
assertThat(match, is(true));
|
||||
```
|
||||
|
||||
## ArangoCursor.noneMatch
|
||||
|
||||
```
|
||||
ArangoCursor.noneMatch(Predicate<? super T> predicate) : boolean
|
||||
```
|
||||
|
||||
Returns whether no elements of this _ArangoIterable_ match the provided predicate.
|
||||
|
||||
**Arguments**
|
||||
|
||||
- **predicate**: `Predicate<? super T>`
|
||||
|
||||
A predicate to apply to elements of this {@code ArangoIterable}
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
boolean match = cursor.noneMatch(e -> e > 5);
|
||||
assertThat(match, is(true));
|
||||
```
|
||||
|
||||
## ArangoCursor.collectInto
|
||||
|
||||
```
|
||||
ArangoCursor.collectInto(R target) : R
|
||||
```
|
||||
|
||||
**Arguments**
|
||||
|
||||
Iterates over all elements of this {@code ArangoIterable} and adds each to the given target.
|
||||
|
||||
- **target**: `R <R extends Collection<? super T>>`
|
||||
|
||||
The collection to insert into
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Collection<Integer> list = cursor.collectInto(new ArrayList());
|
||||
// -- or --
|
||||
Collection<Integer> set = cursor.collectInto(new HashSet());
|
||||
```
|
||||
|
||||
## ArangoCursor.iterator
|
||||
|
||||
```
|
||||
|
@ -38,6 +255,16 @@ ArangoCursor.iterator() : Iterator<T>
|
|||
|
||||
Returns an iterator over elements of the query result.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Iterator<Integer> iterator = cursor.iterator();
|
||||
```
|
||||
|
||||
## ArangoCursor.asListRemaining
|
||||
|
||||
```
|
||||
|
@ -46,6 +273,16 @@ ArangoCursor.asListRemaining() : List<T>
|
|||
|
||||
Returns the remaining results as a _List_.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Collection<Integer> list = cursor.asListRemaining();
|
||||
```
|
||||
|
||||
## ArangoCursor.getCount
|
||||
|
||||
```
|
||||
|
@ -54,6 +291,37 @@ ArangoCursor.getCount() : Integer
|
|||
|
||||
Returns the total number of result documents available (only available if the query was executed with the _count_ attribute set)
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", new AqlQueryOptions().count(true), Integer.class)
|
||||
Integer count = cursor.getCount();
|
||||
assertThat(count, is(5));
|
||||
```
|
||||
|
||||
## ArangoCursor.count
|
||||
|
||||
```
|
||||
ArangoCursor.count() : long
|
||||
```
|
||||
|
||||
Returns the count of elements of this _ArangoIterable_.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
long count = cursor.filter(e -> e < 4).count();
|
||||
// remaining results: [1, 2, 3]
|
||||
asserThat(count, is(3L));
|
||||
```
|
||||
|
||||
## ArangoCursor.getStats
|
||||
|
||||
```
|
||||
|
@ -62,6 +330,16 @@ ArangoCursor.getStats() : Stats
|
|||
|
||||
Returns extra information about the query result. For data-modification queries, the stats will contain the number of modified documents and the number of documents that could not be modified due to an error (if ignoreErrors query option is specified);
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Stats stats = cursor.getStats();
|
||||
```
|
||||
|
||||
## ArangoCursor.getWarnings
|
||||
|
||||
```
|
||||
|
@ -70,6 +348,16 @@ ArangoCursor.getWarnings() : Collection<Warning>
|
|||
|
||||
Returns warnings which the query could have been produced.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
Collection<Warning> warnings = cursor.getWarnings();
|
||||
```
|
||||
|
||||
## ArangoCursor.isCached
|
||||
|
||||
```
|
||||
|
@ -77,3 +365,13 @@ ArangoCursor.isCached() : boolean
|
|||
```
|
||||
|
||||
Iindicating whether the query result was served from the query cache or not.
|
||||
|
||||
**Examples**
|
||||
|
||||
```Java
|
||||
ArangoDB arango = new ArangoDB.Builder().build();
|
||||
ArangoDatabase db = arango.db("myDB");
|
||||
|
||||
ArangoCursor<Integer> cursor = db.query("FOR x IN 1..5 RETURN x", Integer.class)
|
||||
boolean cached = cursor.isCached();
|
||||
```
|
||||
|
|
|
@ -1,114 +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>
|
||||
```
|
||||
# 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>
|
||||
```
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<!-- 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)
|
||||
- [Changelog](https://github.com/arangodb/spring-data/blob/master/ChangeLog.md#changelog)
|
||||
# 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)
|
||||
- [Changelog](https://github.com/arangodb/spring-data/blob/master/ChangeLog.md#changelog)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,3 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Using the ArangoDB Starter
|
||||
==========================
|
||||
|
||||
|
@ -67,4 +68,3 @@ The _Starter_ will decide on which 2 machines to run a single server instance.
|
|||
To override this decision (only valid while bootstrapping), add a
|
||||
`--cluster.start-single=false` to the machine where the single server
|
||||
instance should _not_ be started.
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Deploying using the ArangoDB Starter
|
||||
====================================
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Using the ArangoDB Starter
|
||||
==========================
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Using the ArangoDB Starter
|
||||
==========================
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
# ArangoDB Starter Architecture
|
||||
|
||||
## What does the Starter do
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
# Option reference
|
||||
|
||||
The ArangoDB Starter provides a lot of options to control various aspects
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
# ArangoDB Starter
|
||||
|
||||
This chapter documents the _ArangoDB Starter_.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
# Security
|
||||
|
||||
Securing an ArangoDB deployment involves encrypting its connections and
|
||||
|
|
|
@ -17,3 +17,4 @@ For further information about _datacenter to datacenter replication_, please ref
|
|||
- [Troubleshooting](../../Troubleshooting/DC2DC/README.md)
|
||||
- [Monitoring](../../Monitoring/DC2DC/README.md)
|
||||
- [Security](../../Security/DC2DC/README.md)
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Securing Starter Deployments
|
||||
============================
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com//arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
# Starting an ArangoDB cluster or database the easy way
|
||||
|
||||
Starting an ArangoDB cluster is complex. It involves starting various servers with
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- don't edit here, its from https://@github.com/arangodb-helper/arangodb.git / docs/Manual/ -->
|
||||
Upgrading _Starter_ Deployments
|
||||
===============================
|
||||
|
||||
|
|
Loading…
Reference in New Issue