geofire-js
geofire-js copied to clipboard
Add GeoFire.getUpdateData() to enable multi location updates.
Description
Finishes #76. Add a static method on GeoFire to enable retrieving encoded location that can later be used in a multi location database update.
Code sample
var firebaseRef = firebase.database().ref();
// Generate a new push ID for the new post
var newPostRef = ref.child("posts").push();
var newPostKey = newPostRef.key();
// Create the data we want to update
var updatedUserData = {};
updatedUserData["user/posts/" + newPostKey] = true;
updatedUserData["posts/" + newPostKey] = {
title: "New Post",
content: "Here is my new post!"
};
updatedUserData["location"] = GeoFire.getUpdateData(newPostKey, [37.79, -122.41]);
// Do a deep-path update
ref.update(updatedUserData);
Notes
I am not sure about the name of the method. If you have a better suggestion I am happy to change it. :)
Coverage increased (+0.03%) to 95.011% when pulling 041d821b471a1abffc0e01813d303c3f026d18f9 on cupidi:master into da8e4eabb44f514d9c77d66bb703c1011cd3b27a on firebase:master.
Would really like this feature merged.
i would really love this feature to be merge. i'm trying to store multiple geofire location to different paths in the database using only one single network call. i've search over the internet but ended up here. This is really a great feature for geofire, i really don't know why it hasn't be merged since 2017.