f-miyu / Plugin.CloudFirestore

MIT License
121 stars 44 forks source link

Adding a doc always generates and auto ID not the ID I want to add #81

Closed robertmaxted closed 3 years ago

robertmaxted commented 3 years ago

I'd like to be able to use the AddAsync to add a new doc to a collection with the doc ID being the ID I choose. Below is an example:

`var businessNumber = new BusinessNumberNameModel() { Id = BusinessID, Business_Name = BusinessName };

                            await CrossCloudFirestore.Current
                                             .Instance
                                             .Collection("business_ids")
                                             .AddAsync(businessNumber);
                            Console.WriteLine(businessNumber);`

When I do the above the new doc in firebase cloud firestore has an auto ID..

How do I add a doc with a specific doc ID?? Any advice or a fix would be greatly appreciated. Kind regards, Rob

@f-miyu

robertmaxted commented 3 years ago

https://stackoverflow.com/questions/48541270/how-to-add-document-with-custom-id-to-firestore

Need to use Set instead of Add for specific Doc Ids