Skip to content

Commit

Permalink
fix: treat DOCUMENT() calls as implicit collection reads
Browse files Browse the repository at this point in the history
Since ArangoDB 3.10, it is necessary to include start vertex collections
in the WITH statement for cluster operation, and we might use
EntityFromIdQueryNode somewhere for start vertices.
  • Loading branch information
Yogu committed Nov 28, 2023
1 parent f5cc7d7 commit 083b50f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/database/arangodb/aql-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,10 @@ register(WithPreExecutionQueryNode, (node, context) => {
});

register(EntityFromIdQueryNode, (node, context) => {
const collection = getCollectionForType(node.rootEntityType, AccessType.EXPLICIT_READ, context);
// the DOCUMENT() function only dynamically refers to the collection name, so the coordinators
// do not know about the collections. Therefore, these are implicit reads.
// We should refactor DOCUMENT() to collection traversals in the future to enable optimizations.
const collection = getCollectionForType(node.rootEntityType, AccessType.IMPLICIT_READ, context);
return aql`DOCUMENT(${collection}, ${processNode(node.idNode, context)})`;
});

Expand Down

0 comments on commit 083b50f

Please sign in to comment.