Releases: arangodb/arangojs
v7.0.2
Fixed
-
Fixed incorrect HTTP method call in
patchmethod (#687) -
Fixed empty query results containing
[undefined](#683) -
Fixed
updateByExampleandreplaceByExamplenew value parameter nameNote that these methods are still deprecated. Previously the
newValue
parameter was incorrectly callednewData, which prevented the methods from
working at all.
v7.0.1
v7.0.0
This is a major release and breaks backwards compatibility.
See the migration guide for detailed instructions
for upgrading your code to arangojs v7.
For a detailed list of changes between pre-release versions of v7 see the
Changelog of the final v7 release candidate.
Removed
General
-
Removed ArangoDB 2.8 support
ArangoDB 2.8 has reached End of Life since mid 2018. Version 7 and above
of arangojs will no longer support ArangoDB 2.8 and earlier. -
Removed Node.js 6/8 support
As of version 7 arangojs now requires language support for async/await.
This means arangojs requires Node.js 10 (LTS) or newer to function correctly. -
Removed support for absolute endpoint URLs
This removes the
isAbsoluteoption from the arangojs configuration. -
Removed
ArangoErrorre-exportThe type can still be imported directly from the
errormodule. -
Removed
statusCodeproperties ofArangoErrorandHttpErrorBoth of these error types still expose the HTTP status code as the
code
property. ForArangoErrorthe true HTTP status code may be different and
can still be accessed using theresponse.statusCodeproperty.
Database API
-
Removed
db.edgeCollectionmethodAs arangojs 7 uses the same implementation for document and edge collections,
this method is no longer necessary. Generic collection objects can still be
cast toDocumentCollectionorEdgeCollectiontypes in TypeScript. -
Removed
db.truncateconvenience methodThis was a wrapper around
db.listCollectionsandcollection.truncate.
The behavior ofdb.truncatecan still be emulated by calling these methods
directly.
Collection API
-
Removed collection
createCapConstraint,createHashIndex,
createSkipList,createPersistentIndex,createGeoIndexand
createFulltextIndexmethodsThese methods are no longer part of the official ArangoDB API and can be
replaced by using thecollection.ensureIndexmethod. -
Removed
save(fromId, toId, edgeData)method variantsMethods for creating edges now require the
_toand_fromattributes to
be specified in the edge (document) data and no longer accept these values
as positional arguments. -
Removed
collection.bulkUpdatemethodThe new method
collection.updateAllnow provides this functionality. -
Removed
collection.edgemethodThis method was previously an alias for
collection.document.The method
graphEdgeCollection.edgeis unaffected by this change. -
Removed
graphNameoption foredgeCollection.traversalGraph traversals can still be performed via
graph.traversal.
Graph API
-
Removed generic collection methods from
GraphVertexCollectionAll methods that are not part of the graph API have been removed.
The underlying collection can still be accessed from thecollection
property. -
Removed generic collection methods from
GraphEdgeCollectionAll methods that are not part of the graph API have been removed.
The underlying collection can still be accessed from thecollection
property.
Cursor API
-
Removed
cursor.someandcursor.everymethodsThese methods encouraged overfetching and should be replaced with more
efficient AQL queries.The behavior can still be implemented by using the
nextmethod directly
or iterating over the cursor using theforEachmethod or thefor await
syntax.
View API
-
Removed
ViewResponsetypeThe type
ViewDescriptionrepresents the same structure. -
Removed
ArangoSearchViewPropertiesResponsetypeThe type
ArangoSearchViewProperties & ViewDescriptioncan be used
to represent the same structure.
Deprecated
Database API
-
Deprecated
db.useDatabasemethodUsing this method will affect
Collection,Graphand other objects
already created for the given database and change which database these
refer to, which may cause unexpected behavior.As of arangojs 7 the
db.databasemethod can be used instead to create a
new, separateDatabaseobject using the same connection pool.
Collection API
-
Deprecated
Collectionmethods for simple queries:list,all,any,
byExample,firstExample,removeByExample,replaceByExample,
updateByExample,lookupByKeys,removeByKeys,fulltextThese methods were deprecated in ArangoDB 3.4 and should no longer be used.
They will still behave correctly with versions of ArangoDB supporting these
methods but may be removed in a future ArangoDB release.Their behavior can be emulated using AQL queries.
Graph API
-
Deprecated
graph.traversalandcollection.traversalThese methods were deprecated in ArangoDB 3.4 and should no longer be used.
They will still behave correctly with versions of ArangoDB supporting these
methods but may be removed in a future ArangoDB release.Their behavior can be emulated using AQL graph traversal.
Changed
General
-
Multiple
Databaseobjects can now share a singleConnectionAll arangojs objects now reference a
Databaseobject rather than accessing
the underlyingConnectiondirectly. This allows multipleDatabaseobjects
to be created by using thedb.databasemethod while still allowing the
creation of separate database objects with separate connection pools if
desired. -
Memoized
Database,Collection,Graph,ViewandAnalyzerDatabase objects are now memoized per-connection and the other object types
are memoized per-database. UsinguseDatabasede-memoizes the database
object to prevent unexpected behavior. -
Added support for
Viewinaqltemplates (#667)View(orArangoSearchView) objects can now be passed intoaqltemplates
likeArangoCollectionobjects. -
Moved
collectionToStringhelper intocollectionmodule -
Moved
Dicttype intoconnectionmodule -
Moved
Patchtype intodocumentsmodule -
Removed
Errbacktype from public API -
Renamed
util/foxx-manifestmodule tofoxx-manifest
Database API
-
Renamed method
db.arangoSearchViewtodb.view -
Renamed method
db.createArangoSearchViewtodb.createView -
Replaced methods
db.enableServiceDevelopmentModeand
db.disableServiceDevelopmentModewithdb.setServiceDevelopmentMode -
Flattened database
querymethodoptionsargumentThe optional
optionsargument previously contained an additionaloptions
object with additional query options. These options are now specified on the
optionsargument itself directly.Before:
db.query(aql`FOR doc IN ${collection} RETURN doc`, { cache: false, options: { fullCount: true }, });
After:
db.query(aql`FOR doc IN ${collection} RETURN doc`, { cache: false, fullCount: true, });
-
Changed
db.listServicesoptionexcludeSystemdefault totrueTo be more consistent with the equivalent options in other methods,
the default value has been changed fromfalsetotrue. -
Changed
db.createDatabasereturn type toDatabase -
Renamed
database.setQueryTrackingtodatabase.queryTrackingThe method will now return the existing query tracking properties or set the
new query tracking properties depending on whether an argument is provided. -
Method
db.transactionno longer acts as an alias forexecuteTransactionThe method now only allows looking up transactions by ID. Previously it would
wrapexecuteTransactionif passed the arguments expected by that method.
Collection API
-
Merged
DocumentCollectionandEdgeCollectionAPIsAll collections are now implemented as generic
Collectionobjects.
In TypeScript the generic collection object can still be explicitly cast to
DocumentCollectionorEdgeCollectionfor stricter type safety. -
Renamed
collection.setPropertiestocollection.propertiesThe method will now return the existing properties or set the properties
depending on whether an argument is provided. -
Removed
CollectionMetadatafields fromCollectionPropertiestypeMethods that previously returned
CollectionPropertiesnow return
CollectionMetadata & CollectionProperties. -
Collection methods
save,update,replaceandremoveno longer take
arrays as inputThe array versions have been renamed to
saveAll,updateAll,replaceAll
andremoveAllto reduce the likelihood of mistakes and provide more helpful
type signatures. -
Collection methods will now throw errors when passed documents or document
IDs from different collections where a document key or ID for a document in
the same collection is expectedFor example the following code will now result in an error rather than the
document from a different collection being returned:const aliceId = "alice/123"; // Document from collection "alice" const bobCol = db.collection("bob"); // Collection "bob" const doc = await bobCol.document(aliceId); // THROWS
-
Changed
collection.importoptiontypebehaviorPreviously this option would always default to
"auto".When passing a
string,BufferorBlobas data, the option now defaults
toundefined. This matches the behavior in previous versions of setting
the option explicitly tonull.Additionally, the value
"array"has been replaced with"list".When passing an array as data, the option is now no longer supported as the
corresponding value will be inferred from the arra...
v7.0.0-rc.2
This is a release candidate which is not intended for use in production and has been published under the npm next tag.
To install the latest preview release, run npm install arangojs@next or yarn add arangojs@next.
This is a major release and breaks backwards compatibility.
Fixed
- Renamed
validationoption toschema(#681)
Added
-
Added support for
isDisjointoption in Graph API -
Added support for values
"ignore"and"conflict"inoverwriteMode
option when saving documents using the Collection API -
Added support for
primarySortCompressionandstoredValuesoptions in
View API
v7.0.0-rc.1
This is a release candidate which is not intended for use in production and has been published under the npm next tag.
To install the latest preview release, run npm install arangojs@next or yarn add arangojs@next.
This is a major release and breaks backwards compatibility.
Fixed
- Fixed
export is not definederror in the browser build
v7.0.0-rc.0
This is a release candidate which is not intended for use in production and has been published under the npm next tag.
To install the latest preview release, run npm install arangojs@next or yarn add arangojs@next.
This is a major release and breaks backwards compatibility.
Removed
-
Removed
statusCodeproperties ofArangoErrorandHttpErrorBoth of these error types still expose the HTTP status code as the
code
property. ForArangoErrorthe true HTTP status code may be different and
can still be accessed using theresponse.statusCodeproperty. -
Removed
ArangoErrorre-exportThe type can still be imported directly from the
errormodule.
Changed
-
Renamed
cursor.nextBatchtocursor.batches.next -
Renamed
cursor.hasMoretocursor.batches.hasMore -
Renamed
db.createArangoSearchViewtodb.createView -
Renamed
transaction.runtotransaction.stepThis should hopefully make it more obvious that sequential calls to arangojs
methods should be split into separate calls of this method. -
Added support for
Viewinaqltemplates (#667)View(orArangoSearchView) objects can now be passed intoaqltemplates
likeArangoCollectionobjects. -
Graph methods now also accept
ArangoCollectioninstances instead of namesThis brings these methods behavior in line with that of the
beginTransaction
andexecuteTransactionmethods ofDatabaseobjects. -
Moved
collectionToStringhelper intocollectionmodule -
Moved
Dicttype intoconnectionmodule -
Moved
Patchtype intodocumentsmodule -
Removed
Errbacktype from public API -
Renamed
util/foxx-manifestmodule tofoxx-manifest -
Removed
Collectiontype from public APIAll public APIs reference
DocumentCollectionandEdgeCollectiondirectly.
Added
-
Added
precaptureStackTracesconfiguration option (#599)This option can be used to get more useful stack traces but results in a
performance hit on every request. -
Added
cursor.batchesto provide a batch-wise cursor API -
Added
beforeandafterto theagentOptionsconfiguration option (#585)These methods can be used to track performance metrics for outgoing requests.
v7.0.0-preview.1
This is a preview release which is not intended for use in production and has been published under the npm next tag.
To install the latest preview release, run npm install arangojs@next or yarn add arangojs@next.
This is a major release and breaks backwards compatibility.
Known issues
The inline documentation is currently incomplete. This will be resolved before the final 7.0.0 release is published.
Removed
-
Removed
collection.edgemethodThis method was previously an alias for
collection.document.The method
graphEdgeCollection.edgeis unaffected by this change. -
Removed
graphNameoption foredgeCollection.traversalGraph traversals can still be performed via
graph.traversal. -
Removed
ViewResponsetypeThe type
ViewDescriptionrepresents the same structure. -
Removed
ArangoSearchViewPropertiesResponsetypeThe type
ArangoSearchViewProperties & ViewDescriptioncan be used
to represent the same structure.
Changed
-
Removed
CollectionMetadatafields fromCollectionPropertiestypeMethods that previously returned
CollectionPropertiesnow return
CollectionMetadata & CollectionProperties.
Added
-
Added
authoption to configurationIt is now possible to pass authentication credentials using the
auth
option in addition to callingdb.useBasicAuthordb.useBearerAuth.
Fixed
- Changed async return type of
collection.indexfromIndex[]toIndex
v7.0.0-preview.0
This is a preview release which is not intended for use in production and has been published under the npm next tag.
To install the latest preview release, run npm install arangojs@next or yarn add arangojs@next.
This is a major release and breaks backwards compatibility.
Known issues
The inline documentation is currently incomplete. This will be resolved before the final 7.0.0 release is published.
Removed
General
-
Removed ArangoDB 2.8 support
ArangoDB 2.8 has reached End of Life since mid 2018. Version 7 and above
of arangojs will no longer support ArangoDB 2.8 and earlier. -
Removed Node.js 6/8 support
As of version 7 arangojs now requires language support for async/await.
This means arangojs requires Node.js 10 (LTS) or newer to function correctly. -
Removed support for absolute endpoint URLs
This removes the
isAbsoluteoption from the arangojs configuration.
Database API
-
Removed
db.edgeCollectionmethodAs arangojs 7 uses the same implementation for document and edge collections,
this method is no longer necessary. Generic collection objects can still be
cast toDocumentCollectionorEdgeCollectiontypes in TypeScript. -
Removed
db.truncateconvenience methodThis was a wrapper around
db.listCollectionsandcollection.truncate.
The behavior ofdb.truncatecan still be emulated by calling these methods
directly.
Collection API
-
Removed collection
createCapConstraint,createHashIndex,
createSkipList,createPersistentIndex,createGeoIndexand
createFulltextIndexmethodsThese methods are no longer part of the official ArangoDB API and can be
replaced by using thecollection.ensureIndexmethod. -
Removed
save(fromId, toId, edgeData)method variantsMethods for creating edges now require the
_toand_fromattributes to
be specified in the edge (document) data and no longer accept these values
as positional arguments.
Graph API
-
Removed generic collection methods from
GraphVertexCollectionAll methods that are not part of the graph API have been removed.
The underlying collection can still be accessed from thecollection
property. -
Removed generic collection methods from
GraphEdgeCollectionAll methods that are not part of the graph API have been removed.
The underlying collection can still be accessed from thecollection
property.
Cursor API
-
Removed
cursor.someandcursor.everymethodsThese methods encouraged overfetching and should be replaced with more
efficient AQL queries.The behavior can still be implemented by using the
nextmethod directly
or iterating over the cursor using theforEachmethod or thefor await
syntax.
Deprecated
Database API
-
Deprecated
db.useDatabasemethodUsing this method will affect
Collection,Graphand other objects
already created for the given database and change which database these
refer to, which may cause unexpected behavior.As of arangojs 7 the
db.databasemethod can be used instead to create a
new, separateDatabaseobject using the same connection pool.
Collection API
-
Deprecated
Collectionmethods for simple queries:list,all,any,
byExample,firstExample,removeByExample,replaceByExample,
updateByExample,lookupByKeys,removeByKeys,fulltextThese methods were deprecated in ArangoDB 3.4 and should no longer be used.
They will still behave correctly with versions of ArangoDB supporting these
methods but may be removed in a future ArangoDB release.Their behavior can be emulated using AQL queries.
Graph API
-
Deprecated
graph.traversalandcollection.traversalThese methods were deprecated in ArangoDB 3.4 and should no longer be used.
They will still behave correctly with versions of ArangoDB supporting these
methods but may be removed in a future ArangoDB release.Their behavior can be emulated using AQL graph traversal.
Changed
General
-
Multiple
Databaseobjects can now share a singleConnectionAll arangojs objects now reference a
Databaseobject rather than accessing
the underlyingConnectiondirectly. This allows multipleDatabaseobjects
to be created by using thedb.databasemethod while still allowing the
creation of separate database objects with separate connection pools if
desired. -
Memoized
Database,Collection,Graph,ViewandAnalyzerDatabase objects are now memoized per-connection and the other object types
are memoized per-database. UsinguseDatabasede-memoizes the database
object to prevent unexpected behavior.
Database API
-
Renamed method
db.arangoSearchViewtodb.view -
Replaced methods
db.enableServiceDevelopmentModeand
db.disableServiceDevelopmentModewithdb.setServiceDevelopmentMode -
Flattened database
querymethodoptionsargumentThe optional
optionsargument previously contained an additionaloptions
object with additional query options. These options are now specified on the
optionsargument itself directly.Before:
db.query(aql`FOR doc IN ${collection} RETURN doc`, { cache: false, options: { fullCount: true }, });
After:
db.query(aql`FOR doc IN ${collection} RETURN doc`, { cache: false, fullCount: true, });
-
Changed
db.listServicesoptionexcludeSystemdefault totrueTo be more consistent with the equivalent options in other methods,
the default value has been changed fromfalsetotrue. -
Changed
db.createDatabasereturn type toDatabase
Collection API
-
Renamed
collection.setPropertiestocollection.propertiesThe method will now return the existing properties or set the properties
depending on whether an argument is provided. -
Renamed
collection.setQueryTrackingtocollection.queryTrackingThe method will now return the existing query tracking properties or set the
new query tracking properties depending on whether an argument is provided. -
Merged
DocumentCollectionandEdgeCollectionAPIsAll collections are now implemented as generic
Collectionobjects.
In TypeScript the generic collection object can still be explicitly cast to
DocumentCollectionorEdgeCollectionfor stricter type safety. -
Collection methods
save,update,replaceandremoveno longer take
arrays as inputThe array versions have been renamed to
saveAll,updateAll,replaceAll
andremoveAllto reduce the likelihood of mistakes and provide more helpful
type signatures. -
Collection methods will now throw errors when passed documents or document
IDs from different collections where a document key or ID for a document in
the same collection is expectedFor example the following code will now result in an error rather than the
document from a different collection being returned:const aliceId = "alice/123"; // Document from collection "alice" const bobCol = db.collection("bob"); // Collection "bob" const doc = await bobCol.document(aliceId); // THROWS
-
Changed
collection.importoptiontypebehaviorPreviously this option would always default to
"auto".When passing a
string,BufferorBlobas data, the option now defaults
toundefined. This matches the behavior in previous versions of setting
the option explicitly tonull.Additionally, the value
"array"has been replaced with"list".When passing an array as data, the option is now no longer supported as the
corresponding value will be inferred from the array's contents:If the array's first item is also an array, it will match the behavior in
previous versions of setting the option explicitly tonull.Otherwise it will match the behavior in previous versions of setting the
option explicitly to"documents"or"auto", or omitting it entirely. -
Changed
collection.listreturn type toArrayCursor
Graph API
-
Graph
createmethod (anddb.createGraph) signature changedThe
graph.createmethod now takes an array of edge definitions as the
first argument and any additional options (not just thewaitForSync
option) as the second argument.Before:
await graph.create( { edgeDefinitions: [{ collection: "edges", from: ["a"], to: ["b"] }], isSmart: true, }, { waitForSync: true } );
After:
await graph.create([{ collection: "edges", from: ["a"], to: ["b"] }], { isSmart: true, waitForSync: true, });
-
First argument to
graph.replaceEdgeDefinitionis now optionalSince the new edge definition already includes the edge collection name
that identifies the edge definition, it is now possible to specify only the
new edge definition object without additionally specifying the collection
name as the first argument.Before:
await graph.replaceEdgeDefinition("edges", { collection: "edges", // This is a bit redundant from: ["a"], to: ["b"], });
After:
await graph.replaceEdgeDefinition({ collection: "edges", from: ["a"], to: ["b"], });
-
Graph collection return values now contain
oldandnewproperties when
returnOldorreturnNewoptions are usedThis behavior represents a compromise between remaining consistent with the
behavior of the regular collection method equivalents and remaining
compatible with the ArangoDB HTTP API response object quirks.
Cursor API
- Replaced
ArrayCursormethodshasNextandhasMorewith get...