For the sake of simplicity, I have omitted many other properties. But the bottomline is that the schema is very simple and flexible. As MongoDB is a schema less DB, we can always add new properties very easily.
and i understand you need to have another table with the upvotes/user/post no? to not make possible the double upvote, no?
I also want to know about the likes on post (Actually the real question was about like but i forgot like word after post), so you guys store , likes = ['userObjects' ...] like this ? or any other approach or db like redis ?
Sandeep Panda
co-founder, Hashnode
We use MongoDB as our Database.
Posts have a simple structure as following :
{ _id : 'ObjectID', title : 'String', slug : 'String', author : 'ObjectID', dateAdded : 'Date' ... ... ... upvotes : 'Number', tags : ['ObjectID'] //array of nodes }For the sake of simplicity, I have omitted many other properties. But the bottomline is that the schema is very simple and flexible. As MongoDB is a schema less DB, we can always add new properties very easily.