I am trying to assign current user to a role using cloud functions but i keep getting this error
Error: You cannot add or remove an unsaved Parse Object from a relation
please does anyone has any idea about why i am getting this error.
here is the code
Moralis.Cloud.define('addUserToCollectorRole',async(request)=>{
const roleInDB = new Moralis.Query(Moralis.Role);
roleInDB.equalTo("name", "Collector");
const result = await roleInDB.first({ useMasterKey: true });
await result.getUsers().add(request.user.attributes);
result.save();
return request;
})