I’ve written a function within realm, that it will input an ID and search a collection for the matching ID. So if it is successful then it will return a message
In my document it contain ID, Name.
const doc = context.services.get(“mongodb-atlas”).db(“ChurchRepository”).collection(“MemberDetails”).findOne(query)
.then (result => {
response.setBody(result.Name)
});
This is all good, I can have the result “Simon”
However if I return the function as
return "Welcome " + doc; then I get the result as EJSON.parse(’“Welcome [object Promise]”’)
Any idea?