I am building an application that is using JSON / XML files to persist data. This is why I indicated “outside of SQL” in the title.

I understand one benefit of join tables is it makes querying easier with SQL syntax. Since I am using JSON as my storage, I do not have that benefit.

But are there any other benefits when using a separate join table when expressing a many-to-many relationship? The exact expression I want to express is one entity’s dependency on another. I could do this by just having a “dependencies” field, which would be an array of the IDs of the dependencies.

This approach seems simpler to me than a separate table / entity to track the relation. Am I missing something?

Feel free to ask for more context.

  • matcha_addict@lemy.lolOP
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    1
    ·
    6 months ago

    The reason I am using JSON is so I can have a flat file, sorta plaintext. This way, the storage is easily readable by the user without any special tools, and can even be debugged or modified directly, or using a tool like jq. All this without the need for a heavy database engine, indexing, etc (I am not operating at a large scale). I dont believe MongoDB would be suitable for me based on this, but please let me know if you think I am wrong.