Modeling Payment Data in Firebase 3

I am currently trying to model the data for payments and want me to properly structure my data for the nosql (Firebase) database. I am going to use this node to create a news feed for payments (which will include toId, fromId) and track the total amount specified in the user account. I have the feeling that I am modeling incorrectly as shown below, but would appreciate any advice

{
"payments" : {
    "paymentId" : {
        "amount" : "12",
        "toId" : "userId2",
        "fromId" : "userId1",
        "for" : "lunch"
    }
},

"users" : {
    "userId1" : {
        "name" : "Alex",
        "email" : "alex@gmail.com"
    },  
    "userId2" : {
        "name" : "Ben",
        "email" : "ben@gmail.com"
    },
    "userId3" : {
        "name" : "Charles",
        "email" : "charles@gmail.com"
    }
}

}

+4
source share

Source: https://habr.com/ru/post/1673844/


All Articles