Possibly a duplicate of: https://github.com/arangodb/arangodb/issues/9862
We hit a problem during our tests before upgrading to ArangoDB 3.5.0. Here is a simple script that reproduce the problem.
Note that the problem does not appear if documents are inserted without the _key, _id and _rev attributes.
First execute a fresh 3.5.0 database and connect to the arango shell within it.
docker run -it -p 8529:8529 -e ARANGO_NO_AUTH=1 arangodb:3.5.0
docker exec -it $(docker ps | grep arangodb | awk '{print $1}') sh
arangosh
Then in arango shell.
db._createDatabase('test')
db._useDatabase('test')
db._createDocumentCollection('beats')
db._createDocumentCollection('beatGenres')
db._query(`FOR b IN [
{
"_key": "593127272650",
"_id": "beats/593127272650",
"_rev": "_ZNvVz9a--_",
"genres": [
"593079882856"
]
},
{
"_key": "593125457076",
"_id": "beats/593125457076",
"_rev": "_ZNvVz9W--_",
"genres": [
"593079882858"
]
},
{
"_key": "593131247960",
"_id": "beats/593131247960",
"_rev": "_ZNvU5SK--_",
"genres": [
"593079882852",
"593079882855",
"593079882856"
]
},
{
"_key": "593118556988",
"_id": "beats/593118556988",
"_rev": "_ZNvRRym--_",
"genres": [
"593079882853"
]
},
{
"_key": "593134580252",
"_id": "beats/593134580252",
"_rev": "_ZNvRRya--_",
"genres": [
"593079882855"
]
},
{
"_key": "593119865122",
"_id": "beats/593119865122",
"_rev": "_ZNvRRyW--_",
"genres": [
"593079882858"
]
},
{
"_key": "593133849422",
"_id": "beats/593133849422",
"_rev": "_ZNvRRyS--_",
"genres": [
"593079882858"
]
},
{
"_key": "593112127476",
"_id": "beats/593112127476",
"_rev": "_ZNvRRyO--B",
"genres": [
"593079882853",
"593079882856",
"593079882851"
]
}
]
INSERT b IN beats
`)
With these datas, the following query fails with the following error (both in arangoshell or through the UI):
db._query(`FOR bt IN beats
sort bt._key
LET test =
(
FOR bg IN beatGenres
FILTER bg._key IN bt.genres
RETURN bg.name
)
RETURN test`)
JavaScript exception in file '/usr/share/arangodb3/js/client/modules/@arangodb/arangosh.js' at 99,7: ArangoError 4: Expecting type String (while executing) (exception location: /work/ArangoDB/arangod/RestHandler/RestCursorHandler.cpp:279). Please report this error to arangodb.com
! throw error;
! ^
stacktrace: ArangoError: Expecting type String (while executing) (exception location: /work/ArangoDB/arangod/RestHandler/RestCursorHandler.cpp:279). Please report this error to arangodb.com
at Object.exports.checkRequestResult (/usr/share/arangodb3/js/client/modules/@arangodb/arangosh.js:97:21)
at ArangoStatement.execute (/usr/share/arangodb3/js/client/modules/@arangodb/arango-statement.js:172:12)
at Proxy.ArangoDatabase._query (/usr/share/arangodb3/js/client/modules/@arangodb/arango-database.js:954:45)
at <shell command>:1:4
Again, note that if the documents are inserted without the _key, _id and _rev attributes, the query runs succesfully. Also, the same process can be executed without any problem on both the 3.3 and 3.4 series.
Thanks!
I can reproduce it in 3.5, but not in the current 3.5 development branch and neither in our 3.6 development branch.
So its probably already fixed. You'll just have to wait for the next patch release
Thanks, we'll wait for the next patch release to upgrade!
I can also reduce the problem in v3.5.0, but can confirm that after applying a just one dedicated patch (https://github.com/arangodb/arangodb/pull/9865, already included in 3.5.1) the problem goes away.
The patch is a bugfix for issue #9862 indeed.