Am working on an array to store multiple map location in an array using geopoint
. Have a location:geopoint
that accepts latitude and longitude, which are stored in an array. Cloud firestore only has set
for creating new document update
update existing document and add
which have tried to add new geopoint to the array but it doesn't work. How can I add new location while maintaining the previous data?
Cloud Firestore doesn't currently have an "append an element to an array" kind of operation. For now, your best options are to either:
Your implementation might depend on how many of these different geopoints you're planning on creating, and how you plan on querying them. If you're creating only a handful and want to get all of them back when you're grabbing the associated document, I'd go with one of the first two options. If you're planning on creating lots of geopoints and, say, want to only grab the 3 most recent, I'd go with the third option.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.