I use JS business logic. My Users table has ‘following’ column. I want to use afterRegister event to insert some special User into ‘following’ column (one to many Users) of registered user. I can get my special user via DataQuery.
But there is no ‘following’ array in req.user, there is only password and email. How I can get ‘following’ array of current registered user?
it seems I have solved it by searching for currently registered user by email with DataQuery. is there a more clear way?
Retrieving the user object with DataQuery and specifying in it that you want a specific related property (the “following” property in your case) is the way to do it. So you’re on the right track.
Hi @Evgeniy and @Mark Piller could you please show me how you used DataQuery to solve the problem???
Have you looked into the documentation? In case you find any issue with that, please create a dedicated support topic.
Yes i have looked into the documentation but found nothing concrete, i might create that.
You use DataQuery to retrieve a user which you want to update. This docs describes how to use the DataQuery: https://backendless.com/documentation/data/js/data_search_and_query.htm
After that, when you have a user object, you can update it as it is described in the doc page I provided above.
If your case is more complex or you have any issue with using the SDK, then yes, please create a new topic so that we would be able to investigate your case separately.