I have a question regarding Hierarchical data.
Our app shows posts, that are structured inside parents. Here's how it goes:
prof can contain multiple
sprofs, and each
sprof can contain multiple
subjects, and each
subject contains multiple
Right now, we've set up a temporary MySQL Database that looks like this:
There are 4 tables:
posts. Inside the table
profs you have a row for each
prof - and each
prof has it's unique ID.
Inside the table
sprof has it's own unique ID, but It also has a field for the ID of its parent. For example, if there's a
prof with the ID 1, a
sprof might have a
parent_id of 1 (to indicate that its prof (its parent) is
prof number 1).
And so on - each
subject has a field for its
sprof's ID, and each
post has a field for its
So for example, if we want to get all the posts under the
subject number 2, we do:
SELECT * FROM 'posts' WHERE 'subject_id'=2
A friend told me, that MongoDB can have structured data, so for example I could put a "table" of "posts" under a "row" inside the "table" of "subjects".
Is it true? Will it help? Will it be faster than using MySQL?
I'm not familliar with MongoDB at all, but I'd like to learn that anyway.