I want to change the value of "check" for particular values of "attendance"
FirebaseFirestore.instance.collection('students').doc().set({
'doc':FirebaseFirestore.instance.collection('students').doc(),
'attendance':title,
'check':true
});
What code should I use if I want to change the value of the field of that particular documents.
2
Answers
Use replace set to update Like this:
When you call
doc()
without parameters it generates a reference to a new document.If you want to update an existing document, you’ll need to pass the ID of tht document to the
doc(...)
call.If you don’t know the ID of the document you want to update, you can use a query to look that up based on some value(s) in the document that you do know.