0

I am trying to create a entity relationship diagram for a Non-SQL Database. Basically the data represents a user which can select multiple languages which means it is a "n to m" relationship. Now for your typical SQL based databased you'd create something like this:

I added the code of the diagram in case the link fails to work in the future:

```mermaid
erDiagram

Language }o--o{ UserToLanguage: "is part of"
User }o--o{ UserToLanguage: "is part of"

Language{
    int id
    int name
}

User{
    int id
    int username
}

UserToLanguage{
    int id
    int languageID FK "id of the language"
    int userID FK "id of the user"
}
```

The JSON would look something like this:

[
    {
        id: 0,
        username: "john_doe",
        languages: [
            "english",
            "french"
        ]
    },
    {
        id: 1,
        username: "jane_doe",
        languages: [
            "english",
            "chinese"
        ]
    }
]

Would my er diagram work in this context? I read on this comment (and a view others on so) that a class diagram might be more favourable. Also this method should be more performant than a SQL database, right? As it would save up on queries and general use of the network.

Since I plan on using MongoDB I had a look on their website which was not of much use.

Tobs
  • 29
  • 4

0 Answers0