How to explicitly set the ID of newly created GeoFireStore document?

120 Views Asked by At

The Add method gives you no way of setting the ID upon document creation and there is not set() method.

Is there any way to set the ID of the new document?

1

There are 1 best solutions below

0
On BEST ANSWER

You can generate a new GeoDocumentReference from a GeoCollectionReference by calling doc("id") to specify the ID of the document. With that GeoDocumentReference, you can call its set() method to create that document and write data to it.

This works exactly like the normal JavaScript API for Firestore.