Sorry, I wasn't in yesterday and was unable to respond earlier.
Just to confirm: this issue has been fixed in 2.8, 3.0 and devel on
Friday/Saturday.
In order to make the fix available in 2.8, we will need to build new
release packages.

A workaround to avoid the error is to specify all collection names in the
list of collections for the transaction.
Best regards
Jan

2016-06-24 16:08 GMT+02:00 Jan Steemann <[email protected]>:

> Just reproduced this locally in 2.8 with the following standalone script:
>
> ```
> db._drop("users");
> db._create("users");
> for (var i = 0; i < 100; ++i) {
>   db.users.insert({ _key: String(i) });
> }
>
> db._drop("isFriendWith");
> db._createEdgeCollection("isFriendWith");
> for (var i = 1; i < 100; ++i) {
>   db.isFriendWith.insert("users/" + i, "users/" + (i + 1), { });
> }
>
> db._executeTransaction({
>   collections: {
>     read: [ "isFriendWith" ],
>     write: [ "isFriendWith" ]
>   },
>   action: function() {
>     var db = require("internal").db;
>
>     var results = db._query("FOR v, e IN ANY 'users/20' isFriendWith
> FILTER v._id == 'users/21' LIMIT 1 RETURN e").toArray();
>     require("internal").print(results);
>     if (results.length > 0) {
>       var result = results[0];
>       db.isFriendWith.remove(result);
>     }
>   }
> });
> ```
>
> Will look into this.
>
>
> 2016-06-24 15:25 GMT+02:00 Thomas Weiss <[email protected]>:
>
>> Hi again!
>>
>> Another weird thing I just witnessed; I had the following Foxx route
>> which was working fine:
>> controller.post('/:issuerId/rejectFriendRequest', function (req, res) {
>>     var response = new common.Response();
>>     var issuerId = req.params('issuerId');
>>     var sourceUserId = req.params('sourceUserId');
>>
>>     db._executeTransaction({
>>         collections: {
>>             read: ['users', 'isFriendWith'],
>>             write: 'isFriendWith'
>>         },
>>         action: function () {
>>             var results = db._query("FOR v, e IN ANY 'users/" + issuerId
>> + "' isFriendWith FILTER v._id == 'users/" + sourceUserId + "' LIMIT 1
>> RETURN e").toArray();
>>             if (results.length > 0) {
>>                 var isFriendWith = results[0];
>>                 if (isFriendWith.request && (isFriendWith._from ==
>> 'users/' + sourceUserId)) {
>>                     db.isFriendWith.remove(isFriendWith);
>>                     response.setSuccess();
>>                     return;
>>                 }
>>             }
>>             response.setError(404, 'not found');
>>         }
>>     });
>>
>>
>>     res.json(response);
>> });
>>
>> Forget the fact that the query could be improved considering the
>> assumptions, but just notice that we only read and write the collection
>> named 'isFriendWith' (the 'response' object doesn't access the db).
>>
>> Now I was going through my code in order to remove unnecessary collection
>> declarations, and decided to remove the 'users' collection from the read
>> ones:
>> collections: {
>>     read: 'isFriendWith',
>>     write: 'isFriendWith'
>> }
>>
>> And now this route fails with the following error:
>> 2016-06-24T13:15:25Z [6028] ERROR Error in foxx route '{ "match" :
>> "/v1/user/:issuerId/rejectFriendRequest", "methods" : [ "post" ] }': 
>> 'collection
>> is a nullptr (location:
>> C:\b\ArangoDB-2.8.7\arangod\V8Server\V8Traverser.cpp:799). Please report
>> this error to arangodb.com (while executing)', Stacktrace:
>> 2016-06-24T13:15:25Z [6028] ERROR ArangoError: collection is a nullptr (
>> location: C:\b\ArangoDB-2.8.7\arangod\V8Server\V8Traverser.cpp:799).
>> Please report this error to arangodb.com (while executing)
>> 2016-06-24T13:15:25Z [6028] ERROR     at Error (native)
>> 2016-06-24T13:15:25Z [6028] ERROR     at ArangoStatement.execute (c:\Dev\
>> ArangoDB-2.8.7-win64\share\arangodb\js\server\modules\org\arangodb\arango
>> -statement.js:89:45)
>> 2016-06-24T13:15:25Z [6028] ERROR     at ArangoDatabase._query (c:\Dev\
>> ArangoDB-2.8.7-win64\share\arangodb\js\server\modules\org\arangodb\arango
>> -database.js:106:45)
>> 2016-06-24T13:15:25Z [6028] ERROR     at db._executeTransaction.action (C
>> :\Dev\ArangoDB-2.8.7-win64\var\lib\arangodb-apps\_db\keakr\commands\APP\
>> controllers\user.js:453:30)
>> 2016-06-24T13:15:25Z [6028] ERROR     at ArangoDatabase._executeTransaction
>> (c:\Dev\ArangoDB-2.8.7-win64\share\arangodb\js\server\modules\org\
>> arangodb\arango-database.js:163:10)
>> 2016-06-24T13:15:25Z [6028] ERROR     at C:\Dev\ArangoDB-2.8.7-win64\var\
>> lib\arangodb-apps\_db\keakr\commands\APP\controllers\user.js:447:8
>> 2016-06-24T13:15:25Z [6028] ERROR     at Object.res.action.callback (c:\
>> Dev\ArangoDB-2.8.7-win64\share\arangodb\js\server\modules\org\arangodb\
>> foxx\internals.js:87:5)
>> 2016-06-24T13:15:25Z [6028] ERROR     at c:\Dev\ArangoDB-2.8.7-win64\
>> share\arangodb\js\server\modules\org\arangodb\foxx\routing.js:318:17
>> 2016-06-24T13:15:25Z [6028] ERROR     at execute (c:\Dev\ArangoDB-2.8.7-
>> win64\share\arangodb\js\server\modules\org\arangodb\actions.js:1287:7)
>> 2016-06-24T13:15:25Z [6028] ERROR     at next (c:\Dev\ArangoDB-2.8.7-
>> win64\share\arangodb\js\server\modules\org\arangodb\actions.js:1304:7)
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "ArangoDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to