frontlinersnl / mongo-seed-container

A container to seed mongo databases
0 stars 0 forks source link

Support JSON Arrays #4

Open matijs-toonen opened 1 year ago

matijs-toonen commented 1 year ago

Issue

It is currently not possible to provide seed data in JSON array format. This results in seed data being provided in the MongoDB custom format based on Newline-Delimited JSON (streaming json) where every line is a new entry.

Seed data in this format results in JSON files not being in valid JSON files. This results in issues when running things like linters on these files.

Proposal

MongoDB supports JSON entries in array format via the --jsonArray parameter in the command. This option can be provided with an additional environment variable like MONGO_JSONARRAY which is defaulted to false for backwards compatibility.

matijs-toonen commented 1 year ago

This not only solves issues surrounding things like linters, but also improves both readability (as single line JSON files for big objects can be unreadable) and maintainability.

Mastermindzh commented 1 year ago

@matijs-toonen, can you create an ARCH-guild ticket as well?

matijs-toonen commented 1 year ago

Done, ticket is ARCHGUILD-174. Content is just a link to this issue