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:
https://docs.moralis.io/objects#relational-data