0

I'm trying to create / read a MongoDB configuration file through C#.

The format is YAML and some nodes are deeply nested like this:

storage.wiredTiger.engineConfig.cacheSizeGB : 5

From the getting started documentation, I figured I should create new classes for storage, wiredTiger, engineConfig which will ultimately hold a single property, cacheSizeGB. I feel like I'm writing more boilerplate classes just to define the class hierarchy.

Is there a simpler way that requires less class definitions?

Eric
  • 19,525
  • 19
  • 84
  • 147
  • Wouldn't "storage.wiredTiger.engineConfig.cacheSizeGB" be a single key? Is it actually nested? – gunr2171 Jul 13 '22 at 21:41
  • @gunr2171 I'm new to YAML, I'm not sure of the difference. `storage`, `wiredTiger` and `engineConfig` have multiple other entries. In the sample files, all those keywords are separated on multiple lines with increasing indentation. – Eric Jul 13 '22 at 21:53

0 Answers0