Atomic multi-location update
See original GitHub issueHi! 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:
- 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
- I’m not sure how to work/test out the iOS counterpart; I’m not that familiar with Obj-C
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
Scrap that - that’s exactly what @davorpeic has already done 😉