Database queries

Hello experts,

I have a custom user signup form with userid, firstname, lastname, email and phone no. the database collection contains an additional boolean field which should be updated based on user input.

My query is
I want to update the status field based on userid. how to do this???

Please help

Thanks in advance

You can use the query function to get the record based on the userid and use the update function to update the record.
Here’s a code snippet to better explain what I’m referring:

async function updateCollectionRecord(recordId) {

  let recordToUpdate = await wixData.query("collectionName")
        .eq("_id", recordId)
        .then(results => results.items[0]);

    recordToUpdate.fieldName = "ValueToUpdate";

    wixData.update("collectionName", recordToUpdate)
        .catch((err) => {

Good luck,