Open harinij opened 1 year ago
Hi,
You can use the Firestore’s set() method to set the value of a string field. The set() method takes two parameters, the first parameter is the data you want to set and the second parameter is an optional callback function that will be called when the data is set.
You can use the following code:
db.collection("myCollection").doc("myDocument").set({
myStringField: "myStringValue"
}, function(error) {
if (error) {
console.log("Error setting data: ", error);
} else {
console.log("Data set successfully!");
}
});
This code will set the value of the string field myStringField in the document myDocument in the collection myCollection to the value myStringValue.
I hope this helps!
how to set a value of a string field in firestore