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.