The value returned by db.query()
is an object as defined in the documentation that can not be used directly in your UI, you should return the value in a format that can be shown in the page : a string or an array of strings.
I didn't test but this should work :
function getData(query) {
var db = ScriptDb.getMyDb();
var result = db.query(query);
Logger.log(result.getSize()); // returns '10.0'
var results = db.query({type: 'person'});
var data = [];
while (results.hasNext()) {
data.push(results.next());
}
return data; // data is an array of results
}