Reputation: 2443
I'm from following issue.
Add nested data in Firestore by flutter
I would like to update only car1 name
and img_url
.
I succeed update car1 name
and img_url
. However details
are disappeared without data.
I would like to know how to update the part of data.
_firestore.collection('members').document(${loginUser.uid}).updateData({
'cars': {
'car1': {
'name': name,
'img_url': 'https://www.xxx.xxx/xxx.png',
'details': {
'type': carType,
}
}
}
How can I do that. Please give me advice. Thanks.
Upvotes: 0
Views: 236
Reputation: 1997
You can use setData
with merge:true
_firestore.collection('members').document(${loginUser.uid}).setData({
'cars': {
'car1': {
'name': name,
'img_url': 'https://www.xxx.xxx/xxx.png',
}
},
},
merge:true,
);
Upvotes: 2