Adding additional children when setting in GeoFire Firebase?

前端 未结 1 623
南笙
南笙 2020-12-18 14:59

I\'m trying to set additional info when setting geoFire object in FB.

Something like:

geoFire.set(uniqueId, [latitude, longitude],{\'message\': mes         


        
相关标签:
1条回答
  • 2020-12-18 15:15

    I had the same problem, didn't want to solve this with a workaround, especially by introducing the delay so kept digging and found this: https://github.com/firebase/geofire-js/issues/40

    This basically means we need to restructure the application, where one collection is dedicated to the GeoFire information, another uses the same key to store attached information. Example from the GitHub.

    {
       geofire: {
          "-J9aZZl94Sx6h": { "g": <geohash>, "l": {} }
          "-Jhacf97x4S3h": { "g": <geohash>, "l": {} },
          ...
       },
       "locations": {
          "-J9aZZl94Sx6h": { <location-data> },
          "-Jhacf97x4S3h": { <location-data> }
       }
    }
    
    0 讨论(0)
提交回复
热议问题