I’m completely new to MongoDB. I’m looking to query the following highlighted Array. Any Filter Query I create never seems to work and perhaps the data structure I have saved my data to in Mongo is not correct? Many thanks in advance for your help.
Hi Kushagra, many thanks for coming back to me. As a new user MongoDB will not let me paste all of the sample document into this text box, nor will it let me attach the document to this chain of messages. I’m not sure how to work around this?
I’m new to MongoDB and coding in general and so I’ve just found out how to format it correctly. Please see link below:
Essentially, I want to be able to query an array of observations e.g. 99.6064736490081, 99.6807951926983 etc and have them matching their corresponding months so I am left with 2 columns of data (Date, Observation) that I can then use for further data analysis in python etc. I’ve tried multiple queries myself and I’m not sure why none have worked. Thank you for your help.
The field observations within the object datasets[0].series.0: 0: 0: 0: is not an array it is an object with numbers as field names. This is hardly query-able. I would not know how to do it. You might need to do $objectToArray before doing anything else with it. A real array would be easy. In addition, field names like 0: 0: 0: 0: might causes unforeseen issues down the road.
Thank you Steve. I thought there was something wrong with the structure of the object and that was why I was having the issues so it’s great to have it confirmed. I’ll try and re-structure the data prior to storing and hopefully be able to get it into a queriable format.