f-miyu / Plugin.CloudFirestore

MIT License
121 stars 44 forks source link

How to add a document with a specific Id? #6

Closed manuel-mariani closed 5 years ago

manuel-mariani commented 5 years ago

Found the solution! You have to do await CrossCloudFirestore.Current.Instance .GetCollection("<your collection>") .GetDocument("<custom id>") .SetDataAsync(<your model with data>, null);

manuel-mariani commented 5 years ago

Edit: if that doesn't work or you get duplicates with different id you can use await CrossCloudFirestore.Current.Instance .GetCollection("<your collection>") .GetDocument("<custom id>") .UpdateDataAsync(<your model with data>);