Changelog
[6.13.0] - 2020-01-24
Empty querystring parameters are now omitted
In some cases ArangoDB would be unable to correctly handle querystring
parameters without values. Any paremeters set to undefined
will now
no longer be added to the querystring.
This does not affect parameters set to empty string values.
maxRuntime
option to db.query
methodReplaced linkedlist
dependency with x3-linkedlist
(#601)
The linkedlist
dependency had a memory leak and was no longer maintained.
The replacement should fix this issue.
Changelog
[6.12.0] - 2019-10-16
Added cursor.kill
method
Cursors that have not yet been fully depleted can now be killed using the
cursor.kill
method. Note that this method has no effect if the cursor
is already depleted.
Added cursor.nextBatch
method
Cursors normally fetch additional batches as necessary while iterating over the individual results, this method allows consuming an entire batch at a time.
Changelog
[6.11.1] - 2019-08-30
Fixed View properties not being passed correctly when creating Views (#621)
Renamed internal response.host
attribute to response.arangojsHostId
(#604)
In some environments the host
attribute is already present and read-only.
This should avoid a TypeError
being thrown when a value is assigned by
arangojs.
Changelog
[6.11.0] - 2019-08-16
Renamed db.transaction
to db.executeTransaction
The method for executing server-side transactions is now called
executeTransaction
and the params
argument now must be passed via the
options
object.
For backwards-compatibility the new db.transaction
method will continue to
behave like before when passed an action
string as the second argument.
Note that this behavior is deprecated and will be removed in arangojs 7.
Added support for ArangoDB 3.5 streaming transactions
New streaming transactions can be created using db.beginTransaction
and
existing streaming transactions can be accessed by passing the transaction ID
to db.transaction
.
See the documentation of the transaction.run
method for examples of using
streaming transactions with arangojs.
Added support for ArangoDB 3.5 Analyzers API
See the documentation of the database.analyzer
method and the Analyzer
instances for information on using this API.
Added collection.getResponsibleShard
method
Added support for new ArangoDB 3.5 collection properties
Added support for new ArangoDB 3.5 View properties
Fixed a problem causing empty nested AQL expressions to be converted to bind variables
Nesting an empty AQL expression like the result of calling aql.join
with an empty
array would previously result in the AQL expression not being recognized and being
converted to an object bind variable instead.
Changelog
[6.10.0] - 2018-12-22
Changed Views API to match 3.4 GA implementation
This release updates the Views API to the version implemented in the final ArangoDB 3.4 GA release. Please note that these changes may break code written for earlier ArangoDB 3.4 release candidates.
Added timeout
option to db.query
and request methods (#572)
Note that this merely cancels the request. Queries will still be executed and ArangoDB will still continue processing the request, this will merely result in the socket being forcefully disconnected.
Added query management API (#474)
This implements most endpoints of the HTTP Interface for AQL Queries.
Changelog
[6.9.0] - 2018-11-07
Restored support for credentials in URLs
If the server URL includes credentials, arangojs will now use them instead of
the default username "root" and an empty password. Any credentials explicitly
set using useBasicAuth
or useBearerAuth
will still override the default
credentials as before.
Changelog
[6.8.0] - 2018-11-07
Added any[]
to allowed types for AQL bind parameters
This should help in some cases where the previous TypeScript annotation was too restrictive.
Added support for UNIX socket URLs (#405)
In addition to the unix:///socket/path
and http+unix:///socket/path
URL formats recognized by ArangoDB, arangojs also supports the format
http://unix:/socket/path
commonly supported in the Node ecosystem and
automatically converts ArangoDB endpoint URLs between them.
Changelog
[6.7.0] - 2018-10-24
No longer emitting undefined
values in aql
template strings
Previously using undefined
values in an aql template string would result
in a bind parameter being added with no value, which would always lead to an
error response when ArangoDB executes the query.
Now undefined values will simply be omitted, also easing the conditional
insertion of query fragments.
Changed experimental Views API
This release updates the experimental support for the Views API to the version implemented in the ArangoDB 3.4 release candidate. Please note that this API is still subject to change and may indeed still change until the 3.4.0 GA release.
Updated TypeScript to version 3
This may result in type signatures that are incompatible with TypeScript 2 being added in future releases (including patch releases).
Added nesting support for aql
template strings (#481)
It is now possible to use aql queries as values in aql
template strings:
function createQuery(flowers, color) {
const filter = color ? aql`FILTER flower.color == ${color}` : undefined;
return aql`FOR flower IN ${flowers} ${filter} RETURN flower`;
}
createQuery(db.collection("flowers", "green"));
// FOR flower IN @@value0 FILTER @value1 RETURN flower
// {"@value0": "flowers", "value1": "green"}
createQuery(db.collection("flowers"));
// FOR flower IN @@value0 RETURN flower
// {"@value0": "flowers"}
Previously aql fragments could only be created with aql.literal
, which
does not support bind parameters:
aql.literal("FILTER flower.color == " + JSON.stringify(color));
// Note that we had to rely on JSON.stringify to correctly escape the value
// because the value is part of the literal, not a bind parameter
Added support for undefined
and AQL literals to aql.literal
Passing undefined to aql.literal
will now result in an empty literal as
would be expected. Passing an AQL literal back into aql.literal
will return
the existing literal rather than the string [object Object]
.
Added aql.join
function
The function aql.join
can be used to convert an array of aql
queries into
a combined query:
const users = db.collection("users");
const keys = ["a", "b", "c"];
const fragments = keys.map((key) => aql`DOCUMENT(${users}, ${key})`);
const combined = aql`[${aql.join(fragments, ", ")}]`;
// [DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2), \
// DOCUMENT(@@value0, @value3)]
// {"@value0": "users", "value1": "a", "value2": "b", "value3": "c"}
const query = aql`FOR user IN ${combined} RETURN user.email`;
// FOR user IN [DOCUMENT(@@value0, @value1), DOCUMENT(@@value0, @value2), \
// DOCUMENT(@@value0, @value3)] RETURN user.email
// {"@value0": "users", "value1": "a", "value2": "b", "value3": "c"}
Added allowDirtyRead
option to db.query
and collection.document
Dirty reads are supported in leader/follower replication setups and require ArangoDB 3.4 or later. When performing a request that permits dirty reads, arangojs will load balance across all know leaders and followers and instruct ArangoDB to allow responding with stale or dirty response data. Note that data returned from a dirty read may be out of date or inconsistent.
Changelog
[6.6.0] - 2018-08-28
Re-implemented collection.import
The previous implementation was broken. The new implementation should be backwards-compatible in cases where it previously wasn't broken but is more flexible and also handles buffers.
Added missing dependency on @types/node
(#567)
This should solve TypeScript errors when the dependency was not already added.