question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Atomic multi-location update

See original GitHub issue

Hi! Would it be difficult to add atomic multi-location updates as shown in this Firebase Blog post:

var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
// 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!"
};
// Do a deep-path update
ref.update(updatedUserData, function(error) {
  if (error) {
    console.log("Error updating data:", error);
  }
});

I can try my hand on a pull request (tbh wary, first-ever PR if so) but:

  1. should this plugin’s firebase.update() be edited, or a separate method be instead stubbed out for multi-location updates (different parameter types in firebase.d.ts); and
  2. I’m not sure how to work/test out the iOS counterpart; I’m not that familiar with Obj-C

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
anuragd7commented, Apr 11, 2017

I just tried the atomic multi-location update. The behavior that I seem to be getting is a complete overwrite of the all the keys in the path specified. Is this the intended behavior? Since we are using update I thought only the value of the specified keys would be updated and the rest of the keys would remain unchanged. @lorcanfurey , @davorpeic could you let me know if this is the behavior you observe?

Thanks

1reaction
EddyVerbruggencommented, Jun 20, 2017

Scrap that - that’s exactly what @davorpeic has already done 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Introducing multi-location updates and more - The Firebase Blog
Atomic Writes Across Multiple Locations. Firebase has always supported updating multiple children of a node atomically. For example, let's ...
Read more >
Firebase: atomic transactions and multi-location updates
I'm trying to figure out how to update my data accordingly in Firebase. My app is a social network. Let's say that I...
Read more >
How can I have multiple transactions be atomic with one ...
There is no way to combine multiple transactions, neither in the Firebase Realtime Database, nor in Cloud Firestore.
Read more >
Matt Gregg on Twitter: "@puf Is that single atomic update a ...
I'd try to use a multi-location update when possible, since that doesn't result in resource contention.
Read more >
Multi-location blog post appears to be incomplete - Google Groups
... "Atomic Writes Across Multiple Locations" section on this blog post: https://firebase.googleblog.com/2015/09/introducing-multi-location-updates-and_86.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found