I am learning the MEAN framework. I don't understand why is the mongodb so popular that it is build in the framework and you cannot easily change the database (or can I?).
My questions are.
- Why is the mongodb used in the MEAN framework?
- Why is not there any choice between noSql and Sql database?
- Is the MEAN framework (that uses mongodb) suitable only for some types of web projects or for any type of the web projects?
- How can I create this example database in the mongodb?
If I have for example this relational database:
User
id
name
Car
id
user_id
car_make_id
name
CarMake
id
Name
Than it is possible to easy make queries:
- Show me user and his cars. One query with join.
- Show me all cars in my systems, owners and their types. One query with join.
When I create this database in mongodb:
- I lost the ability of real database transactions.
- How should be the best implementation of this database in mongodb? I can use the same database structure, but it will be slower because I will have to make more requests into the database when I will create the queries above. Or the queries with the $lookup will be slower than real join in the sql database - am I right?
I can change the database structure like this
User
id:
name:
cars: []
Car
id:
car_make_id:
name:
CarMake
id:
Name:
Or I can change the database structure like this. The list of cars is embedded inside the user.
User
id:
name:
cars:
[
{
id:
car_make_id:
name:
}
]
CarMake
id:
Name:
But how can I get: Show me all cars in my systems, owners and their types. Could you help me please to see the world in the mongodb way?