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 ]:
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].
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 :
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 ?