Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GeoFire.getUpdateData() to enable multi location updates. #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cupidi
Copy link

@cupidi cupidi commented Jan 21, 2017

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. :)

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 95.011% when pulling 041d821 on cupidi:master into da8e4ea on firebase:master.

@ericmorgan1
Copy link

Would really like this feature merged.

@deflexable
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants