Hello, I’m writing a cloudfunction right now. I have found out In a beforeSave action I access request.user. I also get the username via request.user.get(‘username’). But I have a column “twitteraccount” in which I have linked another table/object. Here there is a column “handle”. request.user.get(‘twitteraccount’).get(‘handle’) however returns an empty result (via logger). request.user.get(‘twitteraccount’) returns [Object]. What am I doing wrong?
The same rules for
Moralis.Object apply to
Moralis.User as it inherits from
Object. Linked objects are not automatically fetched. Try:
const twitterAccount = await user.get("twitteraccount").fetch(); console.log(twitterAccount.get("handle")
See the docs on Relations here: