I’m thinking to implement many-to-many relations with post and tag.
In Meteor, with one-to-many relation, like post has many comments, comments collection has field "postId" : "h9dCsAfR4uqWHpXNH", that shows to which post a given comment belong. At the same time posts collection don’t have any informations about comments.
In my opinion, with many-to-many relations we’ll have different approach.
My thought is as follows:
posts collection schema:
{ _id: String, title: String, body: String, tag_ids: Array}
tags collection schema:
{ _id: String, title: String, post_ids: Array}
So, posts collection will have a tag_ids field of Array type that will contain only ids of the tags it have, same for tags collection will have only array of post_ids.
I’d like to know that’s ok or if there better idea…
Thanks.
PS: The question is not about if I have to use RDBMS or not.
UPDATE 1:
My working app is http://askar-blog.meteor.com
At the moment I can create posts and tags as a separate collections without any relation.
I want to add checkboxes that will list all available tags during post creation like in the Rails app http://postag.herokuapp.com/


