[SOLVED] How to get and change the value of an array from a moralis database?

Hello. I have a “_User” Moralis database with users. Each user has a cell “followers” which is an array. How can I find the user I need in this database and delete or add rows in the “followers” array?

what did you try by now?

I tried to get the user I need using the cloud function. But the problem is that I need constantly different users. It works. but only for one user. I can’t pass any value from outside to the cloud function, if I understood everything correctly.

cloud.js

main.js

You can send parameters to a cloud function. And you can access them after that in the cloud function.

You will find some examples on this forum.

Perhaps this is the best I could find on this topic. but it doesn’t work.

cloud.js

main.js

console:
image

you can take a look here:

I found how to pass and use parameters in cloud functions, but I get an error when I want to set the value of the “followers” array

error:
image

cloud.js

main

query.find returns an array and not an object

you have to get the user object from that array first

1 Like

thanks, everything works fine

1 Like