Hi guys,
I am trying to write a query that looks like this:
Moralis.Cloud.define("fetchMyVotes", async(request) => {
const query = new Moralis.Query("myObjects");
const pipeline = [
{ match: { voters.voter: request.user.id } }
];
return await query.aggregate(pipeline);
});
This does not work an throws with the error “Invalid Function”.
myObjects table has a column called voters containing an array of objects like this:
[{“voter”: “user1”, “someValue”: 50}, {“voter”: “user2”, “someValue”: 89}, …]
How can I query for the voter property from within a cloud function?