As a learning exercise, I'm trying to query ScriptDb and return a person's name when my script has their email address. The function below returns "ScriptDbResult" instead of the correct name (which should be Patrick Farmer - see the list below the function). Can somebody please advise on what I'm doing wrong?
function getNameFromDb() {
var email = "[email protected]";
var db = ScriptDb.getMyDb();
var result = db.query(
{Names: {Emails: email}});
Logger.log(result);
}
This is what the Logger shows is in the database:
{
"Emails": "[email protected]",
"Names": "Luca Jenkins"
}
{
"Emails": "[email protected]",
"Names": "Patrick Farmer"
}
{
"Emails": "[email protected]",
"Names": "Elizabeth Jennings"
}
{
"Emails": "[email protected]",
"Names": "Gabriel Ryan"
}