Data consistency with Multi-path updates - The Firebase Database For SQL Developers #7
Why Stack Overflow recommends it
Stack Overflow users link it when they ask how to keep duplicated or denormalized data in sync in Firebase, since it demonstrates atomic multi-path updates and lookup paths.
Recommended by 4 people across 4 different months, 2017 to 2022.
What it is
A 10-minute episode of the Firebase team's 'Firebase Database for SQL Developers' series on keeping denormalized data consistent. It shows how multi-path updates and lookup paths let you write the same data to several locations in one atomic operation.
What people said
Recommends Ciprian · 2017-09 · Stack Overflow · on “Firebase-database: Structure for event application with data consistency”
As many have before me, I am building an event app using Firebase as the database. After watching this [this video] I think that my current data structure is wrong so I want to change it. This is something that I hope will keep track of which events users have been to, their responses, check ins and help update user information like in the video. { "events": { "event1": { "title": "Event 1", "venue": { "venue1": true }, "guests": { "user1": true, "user2": true } }, "event2": {} }, "locationHistory": { "location1": { "user1": true, "user2": true }, "location2": { "user3": true } }, "userCheckIns": { "event1": { "user1": true } }, "userResponses": { // not sure about these responses "event1": { "us
Recommends Stratubas · 2019-10 · Stack Overflow · on “How to get full data from many to many relationship in firebase db android?”
This video explains denormalization [LINK] and this one explains how to maintain consistency using multi-path updates [this video] . The rule of thumb is that you should structure your database according to your views.
Recommends Antonio Ramirez · 2021-03 · Stack Overflow · on “how to save a document to a different collection by reference in firestore in react”
Hi there!, have you tried adding a `.then` after the `.then( async (querySnapshot) => {` in order to force the `idList.map()` block to run after the `setIdList`. Data consistency or what you call `can you make it so that you add these documents to a collection, but when he original document is changed these are also changed?` is addressed in this firebase video: [this video] Have you taken a look at it?
Recommends Thomas Uchiha · 2021-04 · Stack Overflow · on “VueJs + Firebase”
While I do respect your choice of using Firebase, I would have opted for an SQL database for your case because you're gonna have a lot of relations. aidangarza's answer is one way to do it but it also expensive when thinking in long term. Firebase will count your reads every time you query from supplierProducts and then when you want to show all the products and suppliers data that are linked. Let's say a supplier has 300 products, every time you want to query all products linked to that supplier, Firebase will count 300 reads. So, what I recommend you is to assign every product to a supplier et then copy the product data to the supplier data : "products": { "productKey1": { "name": "Product
Cites Jim · 2017-01 · Stack Overflow · on “Is There Such A Thing As "Multi-Path Push" in Firebase Real-Time Datasbase?”
I was watching this video [this video] which talks about multi-path updates in Firebase. Multi-path updates are great because they allow you to call the firebaseRef.update() method two or more times while having them be one atomic, all-or-nothing operation. This is great, but in my current situation I don't want to use the update() method. Instead, I want to use the FirebaseRef's push method and allow Firebase to generate a unique key for my object. The tricky part is that I have denormalized my data so that it's in two places. What I would really like to do is have an atomic, all-or-nothing operation that uses Firebase's push() operation to create a unique key and then save the object with that
Cites Maurício Jourdan · 2017-02 · Stack Overflow · on “Firebase Invalid key: . Keys must not contain '/', '.', '#', '$', '[', or ']'”
This is Multi-path updates ,I don't think they removed this function from Firebase. Look the date of this video [this video]
Cites JeffMinsungKim · 2017-12 · Stack Overflow · on “Firebase denormalization data consistency issue”
I'm currently using Ionic CLI 3.19 with Cordova CLI 7.1.0 (@ionic-app-script 3.1.4) The problem that I’m currently facing with is, I should update friends node values simultaneously every time the related data get changed from elsewhere. I’d like to clarify my objective with some screenshots to make it more clear. As you can see from the image below, each child node consists of a user array that has a user id as a key of friends node. The reason why I store as an array is because each user could have many friends. In this example, Jeff Kim has one friend which is John Doe vice versa. [LINK] When data in users node gets changed for some reason, I want the related data in friends node also wan
Cites Rosário P. Fernandes · 2018-02 · Stack Overflow · on “Firebase NoSQL Data modeling - Like counter”
This Firebase Sample [LINK] recommends having the counter( likes_count ) under each post. And also having a node( likes ) with a list/ lookup [this video] . Like this: "images": { "100": { "imageUrl": "../../image.png", "likes_count":2, "likes":{ "200":true, "201":true } }, "101": { "imageUrl": "../../image.png", "likes_count":1, "likes":{ "201":true } } } This way you'll ensure only one like per user, because keys must be unique under a Firebase Realtime Database node, and the user ids are used as keys under the likes_count node. You can also know which users liked the photo because their uids are there. And obviously, you can see how many likes a photo has by accessing the counter.
Cites thebeancounter · 2019-02 · Stack Overflow · on “dynamodb update denormalized data and keep consistency”
I am using dynamodb with python API and denormalize my data in order to keep the reads fast. The think is that I am worried about keeping the consistency when updating my data say i have a table of users, each has a key and a name, and a table of purchases each has a key and a data containing buyer key (user) and the buyer's name. I would like to update the user's name and update all his purchases using an atomic operation, like available in firebase (multi path update) explained here [this video] How can I do that? Thanks
Cites Musa Jahun · 2021-02 · Stack Overflow · on “How to model the NoSQL database”
[LINK] In NoSQL, we have Collections and documents The NoSQL equivalent of your schema is having three collections Customer Collection Vehicle Collection Customer_Hire_Vehicle Collection in Customer Collection, every customer will have it's own document, you can choose to make the document Id the Customer Id, or use an alternative which is generating your own customerId in the Vehicle Collection, each document contains the Registration No, Brand, and since each vehicle has one owner, owner fields, can just be added to the Vehicle document for the Customer_Hire_vehicle collection you can add all the fields of customer and fields of vehicle and also add hireDate so you know when a customer hir