Hey am trying to fetch the user from (_EthAddress class) using eth address, then using that result (user) am trying to check the email field in the _User class whether it is undefined or not. But the problem here is I could only use .find({useMasterKey:true}) which fetch all the data from a class and other fucntions like .equal etc aren’t working.
Please check my code below
Moralis.Cloud.define("exists", async (request) => {
const query1 = new Moralis.Query("_EthAddress");
const query2 = new Moralis.Query("_User");
query1.equalTo("objectId", request.params.eth);
const result = await query1.find({useMasterKey:true});
query2.equalTo("objectId", result.user);
const result2 = await query2.find({useMasterKey:true});
if (result2.email === undefined) {
return true;
}
else {
return false;
}
});
The input will be eth address. The cloud code present in the documentation is not working for me. Looking for a quick fix so that I could proceed with my college project. Deadline is approaching