Re:RethinkDB, SageMath, Andreessen-Horowitz, Basecamp and Op...
by tiglionabbit on Sunday October 09, 2016 @03:22PM
(#12672887)
As soon as you want to view something through a different direction you run into this problem. Sure, you can embed chat messages into a conversation, but what if you want to look up every message by a particular user?
I would be surprised to find that 90% of apps don't have this kind of requirement. Pokemon is easy because that data is static.
Re:RethinkDB, SageMath, Andreessen-Horowitz, Basecamp and Op...
by tlarkworthy on Monday October 10, 2016 @11:23AM
(#12677560)
Viewing all posts by a user is solved with classic denormalization. You maintain a separate index of post by user and do two writes per chat msg. It's a case where a user has no incentive not do the second write so it be fine to implement clientside. If however it was business critical, you would have a server side process listen to all chat messages and write the user to message index with the admin account. That index would essentially be eventually consistent.
Instead, your server should listen to the Firebase, rather than have writes go a separate path (which loses lots of useful features). I think the term now is a client-database-server architecture.
it's not actually a problem for 90% of apps. It's usually in the users best interest not to break their relationships in the db. Think chat. Think info services like Pokemon. Cross table transactions are relative minority in the space of useful apps that's can make money. For those more complex domains, you need technical know how, and Firebase is a useful system component in a larger architecture.