How do make specific queries for columns in my class?
For example, I have a Metadata class and inside that class are columns: ethAddress, background, and character.
What Iโm trying to do is when the user presses the Activate button it calls onActivateBackground(), which gathers the new metadata and suppose to update the data in Background column in the backend for that user.
The code snippet is below:
// function to change Background
const onActivateBackground = async ({ type, name, thumbnail, link }) => {
let ethAddress = user.get("ethAddress");
// check to see if there is an instance in Metadata class for ethAddress
const Metadata = Moralis.Object.extend("Metadata");
const query = new Moralis.Query(Metadata);
query.equalTo("ethAddress", ethAddress);
query.select("Background");
const results = await query.first();
// get all data from local and update data on backend
results.set("type", type);
results.set("name", name);
results.set("thumbnail", thumbnail);
results.set("link", link);
await results.save();
};
Why doesnโt this work? The data is not updating on the backend. Any help would be appreciated!