I have a personal project about writing articles. I do in nosql with mongoose. For my API i use nodejs + express. But i'm fluent with sql, but i'm begginer in Nosql...
My problem is about my articles with categories.
I want set 2 level of categories like that :
Category 1
- Subcategorie 1
- Article
- SubCategorie 2
- Article
- SubCategorie 3
- Article
Category 2
- Subcategorie 4
- Article
- SubCategorie 5
- Article
- SubCategorie 6
- Article
Then my articles are populate in subCategories.
I started to set 3 documents :
- Categorie
- SubCategorie
- Articles
Like this way, i can populate my articles in SubCategorie, and populate my SubCategorie in Categorie.
But i'm not sure than is the best way to use mongoose and nosql in general. I need an other point of view.
I want respect the best practices obviously.
To be simple i'll need to :
- Display all articles from SubCategory
- Display all articles from Category
- Display Category and SubCategory on the page of one article.
I would permit to use only the existent category as well.
Any suggestion ?
Thanks a lot ;)