Tracking relationships in NOSQL

In NoSQL, there is no way to ‘relate’ the post with the comments.

So, what do you do?

Well – you essentially store the postId and the commentId – for EACH comment (i.e. , you store post1,comment1, post1,comment2….and so on)

This storage will work – but will be optimized for one type of query (all comments for a given post)
If you have another type of search (say, all Users who commented on this article), you are screwed. You did not store the userId along with the commentId – so again, you will be back to the drawing board.

However, if all you really care about is getting all comments on a post (first type of query), you are not only set, you will have noticeably faster retrieval times (compared to the relational model). Especially as the data set gets larger and larger.

Cloud Advisory Services | Security Advisory Services | Data Science Advisory and Research

Specializing in high volume web and cloud application architecture, Anuj Varma’s customer base includes Fortune 100 companies (, British Petroleum, Schlumberger).

All content on this site is original and owned by AdverSite Web Holdings, Inc. – the parent company of No part of it may be reproduced without EXPLICIT consent from the owner of the content.

Anuj Varma – who has written posts on Anuj Varma, Technology Architect.

Leave a Reply

Your email address will not be published. Required fields are marked *