A little lesson about document database modelling
March 3, 2014
This is just a short thing that I experienced when doing the data layer for AptiTalk. AptiTalk is an attempt to create a corporate chat, we want something like Hangout but better. Yeah, we’re not only best - we are the most humble as well!
Ok, in this simple setting I learned a thing about using document databases (Mongo in this case). The data model is really simple. It’s just a Posts, Replies and Hashtags. So we created the Posts like this (using Mongoose):
Let’s leave the Replies out of this discussion for now. I think I have more to say about that, but I haven’t tried it yet. The Hashtags in turn is just the Tag and a reference to all the posts that contains that hashtag. Like this:
Notice the reference to the Post-collection in the pots-array. Both me and...