I populated a table using a moralis query and its returning the data just fineā¦ however if there are multiple results using the same parameter I only want the last returned. Iām creating an inbox so I only want the latest object displayed from a specified user, not all of them. I tried adding aggregate-limit:
.aggregate({limit: 1})
Nothing was returningā¦ Hereās my code:
const { data } = useMoralisQuery("Messages", query =>
query
.equalTo("to", user.get("username"))
);
...
const products = data.map(item => ({
username: JSON.stringify(item, ['from']),
content: JSON.stringify(item, ['content']),
date: JSON.stringify(item, ['updatedAt'])
}))