I started to use mongodb instead of SQL databases in my new projects. And I have a lot of questions how and when use mongodb instead of sqldb. In my new project I want to have user and projects,categories(and many many more) per users. And if is better to create one colllection 'users' and add there project,categries e.g.
[
{
userName: 'John',
products: [
{
productName: 'Product'
},
{
productName: 'Product2'
},
{
productName: 'Product3'
},
{
productName: 'Product4'
}
],
categories: [
{
categoryName: 'Category'
},
{
categoryName: 'Category2'
},
{
categoryName: 'Category3'
},
{
categoryName: 'Category4'
}
]
}
]
Or create products and categories collections and relation to user? If it comes to the second way do you have any tutorials about relations in mongodb? Or any tutorials which can teach me how to change my thinking about databases? Because I dont know how to build data structure for nosql databases.