Document structure

Asked

Viewed 39 times

0

Hello, I’m starting to learn Mongodb, and I have a question I haven’t found anywhere:

Documents from the same collection may have different structures. Example:

{
    "id": "1",
    "name": "John"
},
{
    "id": "2",
    "name": "Mary",
    "age": 30,
    "isBlocked": false
}

Having different JSON objects in the same collection, can this cause many problems? For example, when handling/filtering data, etc.

It is a mistake to have collections with different JSON objects?

I thank those who clarify this question, my thinking is still very much focused on traditional SQL.

Thanks.

  • I find it a mistake within a collection to have several types of documents, maintaining a standard can in the future avoid problems.

  • I made a change to the title by removing the mongodb tag, so it is only in tags.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.