0

I'm currently discovering MongoDB and from what I understand, it appears there are several ways to create a schema according the use case. I have build a schema, with an embedded document but I'm really not sure it is the best model.

On the one hand, I have an excel file containing different information on plant sites which I have stored (using mongoengine in python) in a DynamicDocument [ Sites ]:

enter image description here

On the other hand, I have a bunch of csv files containing recorded values for each site that I import and store in a Document [ Details ], which is embedded in the "DETAILS" field of the above DynamicDocument [Sites].

enter image description here

I have chosen to create list fields in [Details], given there are thousands of values ; but I'm really not sure it is the best approach as I'm currently unable to find a way to perform aggregate queries.

For exemple, if I want to get all that is Sites.INDUSTRY = 'Commercial Property', the following works just fine :

enter image description here

but how can I get the mean of the field "value" for all INDUSTRY = 'Commercial Property' ? it is possible with my schema or should I use another structure ?

ForceBru
  • 43,482
  • 10
  • 63
  • 98

1 Answers1

0

After few research, I found the following regarding times series and mongo db : https://www.mongodb.com/blog/post/time-series-data-and-mongodb-part-2-schema-design-best-practices