Reputation: 63
db.broad_broad.byExample({"location":"space_1"}).toArray()
with my database this returns
[
{
"_id" : "broad_broad/416394873974",
"_key" : "416394873974",
"_rev" : "554852115738",
"location" : "space_1",
"space_1" : {
"players" : {
"2" : [
"ninja"
]
}
}
}
]
after many hours can make this happen in Foxx
Upvotes: 1
Views: 145
Reputation: 3267
i am not sure if i understand the question correctly so let me repeat it in my words: You have the query
db.broad_broad.byExample({"location":"space_1"}).toArray()
which is working in arangosh
as expected.
Then you copied it to a Foxx app and it is not working, correct?
Most likely it is a missing require
for the internal db module, which is always loaded in the shell, but not loaded in the Foxx environment.
The following minimal Foxx App should work for your example:
var db = require("internal").db; // Mind this line here
var Foxx = require("org/arangodb/foxx");
var app = new Foxx.Controller(applicationContext);
/** Short description
*
* Long description.
*/
app.get("/test", function(req, res) {
var result = db.broad_broad.byExample({"location":"space_1"}).toArray();
res.json(result);
});
If this does not solve your issue is it possible to you to find the error message in the server log to help me debugging?
Upvotes: 2