Moralis DB update query is not working

Hello,
I am trying to find a record from the DB and updating a column value but it is throwing error .
Code:

const Tokens = Moralis.Object.extend("tokens");
    const query = new Moralis.Query(Tokens);
    query.equalTo("address", address.toLowerCase());
    query.find().then((obj) => {
        obj.set("isNew", 0);
        obj.save();
    });

Error:

UnhandledPromiseRejectionWarning: TypeError: obj.set is not a function

you could try to log to see what it is in that obj variable there, find may return a list and not an object

1 Like