0

Can someone explain why MongoDB config file is written in YAML and not in JSON format?

This is not a problem for me, it's just consistency feeling that when everything is around JSON/BSON , then config file could also use that flow.

Is it more about some Linux conventions ?

knm
  • 61
  • 6
  • Because YAML is a superset of JSON. As stated in [their docs](https://docs.mongodb.com/manual/reference/configuration-options/#id1). – blueren Nov 29 '17 at 13:05
  • blueren: It's not a perfect superset, though, there are some rare exceptions – tinita Nov 29 '17 at 13:09
  • 2
    knm: one advantage of YAML is that it allows comments, which I consider very helpful in config files. Also, personally, I find it more readable and writeable if I don't have to put everything in quotes. – tinita Nov 29 '17 at 13:11

1 Answers1

2

I did some quick research on this rather odd question. Found the below reasons:

  1. Because YAML is a superset of JSON. As stated in their docs.

  2. JSON can't have comments. Comments are something very important to a config file. Else you wouldn't know what is used to configure what!

  3. Discussion 1

  4. Discussion 2

  5. Brackets. Miss one bracket, and someone dies.
blueren
  • 2,730
  • 4
  • 30
  • 47
  • Normal questions are asked when one doesn't know something, odd questions are asked when curiosity doesn't know something. Thanks blueren, my curiosity owes you. – knm Nov 30 '17 at 10:26