To go with the answer above, you have two ways to achieve this, with either the save() function or the update() function.
The save function would be the best option for yourself as it will use the update function by itself if needed.
Also, just note that if you are letting the user update their info from a dataset which has their user Id connected, then you can simply just use the submit button and not need the use of any code. See this example here for more info - https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area#update-page-1
If you use save, then see here.
https://www.wix.com/corvid/reference/wix-data.html#save
Examples
Save an item in a collection
import wixData from 'wix-data';
// ...
let toSave = {
"title": "Mr.",
"first_name": "John",
"last_name": "Doe"
};
wixData.save("myCollection", toSave)
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
/* item is:
*
* {
* "_id": "rifk4nrk-dj4o-djhe-oidk-fnoqw4oiglk4i",
* "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
* "_createdDate": "2017-05-24T12:33:18.938Z",
* "_updatedDate": "2017-05-24T12:33:18.938Z",
* "title": "Mr.",
* "first_name": "John",
* "last_name": "Doe"
* }
*/
If you use update, you can see a code example in a forum post in the related posts.
Just be aware that when you use update, you need to update all fields otherwise they will be lost.
The update()function compares the_id property of the specified item with the _id property values of the items in the specified collection. If an item in the collection has that_id value, update replaced the item’s property values with the ones in the specified item. If the existing item had properties with values and those properties were not included in the specified item, the values in those properties are lost. The item’s _updated Dateproperty is also updated to the current date.
Examples
Update an item with a specified ID in a collection
import wixData from 'wix-data';
// ...
let toUpdate = {
"_id": "00001",
"title": "Mr.",
"first_name": "John",
"last_name": "Doe"
};
wixData.update("myCollection", toUpdate)
.then( (results) => {
let item = results; //see item below
} )
.catch( (err) => {
let errorMsg = err;
} );
/* item is:
*
* {
* "_id": "00001",
* "_owner": "ffdkj9c2-df8g-f9ke-lk98-4kjhfr89keedb",
* "_createdDate": "2017-05-24T12:33:18.938Z",
* "_updatedDate": "2017-05-24T12:33:18.938Z",
* "title": "Mr.",
* "first_name": "John",
* "last_name": "Doe"
* }
*/