Update dataset item delets all the value`s

Hello!

so im using the _id to update a item in my Fighters dataset (will paste the code below). But when i read the Wix velo api documentation i read/understand if i use the _id to find the item i can update the field key without losing my other values. Well this does not work and i dont know how to modify my code so it wont delete all other values in the item :frowning:

This line of code deletes all value`s from the item

// Updating the fighter to be active
                await wixData.update("Fighters", {
                    "_id": fighterData._id,
                    "activeFighter": true
                });

Code below is the combined code of above and what it needs to do once it got updated.

async function checkAndModifyFighterStatus(member, teamName) {
    try {
        const results = await wixData.query("Fighters")
            .eq("fullName", member)
            .limit(1)
            .find();

        if (results.items.length > 0) {
            const fighterData = results.items[0];

            console.log(`${member} (_id: ${fighterData._id}) found in Fighters database.`); // Logging _id

            if (!fighterData.activeFighter) {
                console.log(`%c${member} is not active, activating...`, "color: orange;");

                // Updating the fighter to be active
                await wixData.update("Fighters", {
                    "_id": fighterData._id,
                    "activeFighter": true
                });

                // Fetching the team data
                const teamResults = await wixData.query("TeamRegistrationcustom")
                    .eq("teamName", teamName)
                    .limit(1)
                    .find();

                if (teamResults.items.length > 0) {
                    const teamData = teamResults.items[0];

                    console.log(`Team ${teamName} (_id: ${teamData._id}) found in TeamRegistrationcustom database.`); // Logging _id

                    // Checking teams database
                    if (teamData.tokens && teamData.tokens > 0) {
                        //Updating the team tokens by deducting 1
                        await wixData.update("TeamRegistrationcustom", {
                           "_id": teamData._id,
                           "tokens": teamData.tokens - 1
                        });
                    } else {
                        console.log("No tokens to deduct or team tokens are not defined.");
                    }
                } else {
                    console.log("Team not found.");
                }
            } else {
                console.log(`%c${member} is active: YES`, "color: green;");
            }
        } else {
            console.log(`${member} is not found in the Fighters database.`);
        }
    } catch (error) {
        console.log('Error checking and modifying fighter status:', error);
    }
}

if some one would be able to adjust the code so it wont break… im kinda confused now… hahah sorry if i dont use proper terms im learning JS coding while im building the website.

async function checkAndModifyFighterStatus(member, teamName) {
    try {
        console.log(teamName + ' : 1st check team name');
        const results = await wixData.query("Fighters")
            .eq("fullName", member)
            .limit(1)
            .find();

        if (results.items.length > 0) {
            const fighterData = results.items[0];

            console.log(`${member} (_id: ${fighterData._id}) found in Fighters database.`); 

            if (!fighterData.activeFighter) {
                console.log(`%c${member} is not active, activating...`, "color: orange;");

                // Modifying the activeFighter property of the retrieved item
                fighterData.activeFighter = true;

                // Updating the fighter item in the database
                await wixData.update("Fighters", fighterData);
            } else {
                console.log(`%c${member} is already active: YES`, "color: green;");

                // Fetching the team data
                const teamResults = await wixData.query("TeamRegistrationcustom")
                    .eq("teamName", teamName)
                    .limit(1)
                    .find();
                console.log(teamName + ' team name');

                if (teamResults.items.length > 0) {
                    const teamData = teamResults.items[0];
                    console.log(`Team ${teamName} (_id: ${teamData._id}) found in TeamRegistrationcustom database.`); 

                    // Checking teams database
                    if (teamData.tokens && teamData.tokens > 0) {
                        // Modifying the tokens property of the retrieved team item
                        teamData.tokens -= 1;

                        // Updating the team item in the database
                        await wixData.update("TeamRegistrationcustom", teamData);
                    } else {
                        console.log("No tokens to deduct or team tokens are not defined.");
                    }
                } else {
                    console.log("Team not found.");
                }
            }
        } else {
            console.log(`${member} is not found in the Fighters database.`);
        }
    } catch (error) {
        console.log('Error checking and modifying fighter status:', error);
    }
}

code fixed and working

So notice it does not work… it does put all values back in place but the main problem is that for example tags are being put back as strings…
image
and before they are as tags displayed

So yea still does not work hahah atleast my stuff is not being deleted. any support woudl be great !