Answer the question
In order to leave comments, you need to log in
What is the best way to organize a MongoDB database (using Mongoose)?
Hello! I have this question: how best to organize a database on MongoDB (Mongoose):
Let's say we have two entities: User (user) and UserProfile (user profile).
How best:
1. Divide User and UserProfile into two models
2. Do everything in one model, make something like this scheme:
{
username: {},
profile: {
firstName: {},
lastName: {}
}
}
Answer the question
In order to leave comments, you need to log in
And why an extra level of nesting, what is the point of storing them separately.
In my life I came across both cases in both cases I wanted to shove rebar in the ass to programmers like you.
Make just one table with three fields without any idiotic nesting and different entities.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question