Personal I have a question that I believe is basic to anyone who is starting with nosql and comes from classic relational structures.
Well, let's look at a simple example for relational structures:
- I have the table person with id and person_name;
- I have the address table with id, people_id, street and number;
In the above description I have a one to many basic relationship where a person has many addresses. In a standard CRUD I can update an address of the person with the id of the address. If I want to list all the addresses of a person is also simple, simply filtering the address table by the person_id.
Now let's go to nosql. In the searches I've done, the ideal is the address being a sub document of the person document, which would look something like this:
"Pessoa":{
"_id": "12asdf213",
"nome": "João da Silva",
"endereços": [{
"logradouro": "Vila do Chavez",
"numero": 71
}, {
"logradouro": "Cidade Z"
"numero": 14
}]
}
My question is, how could I update the number of the Vila Chavez area without having an identifier?
In searches I also found that I can reference by creating a document for the address and making a common relationship between the two documents. But that for nosql is not very performatic or indicated.