Issue with $push operator

Hi @Jason_Tran. Thanks for your answer.

To reply to your questions:

1 - Yes that is correct. Here it’s only a snippet but in production environment we have up to 6 documents to add in "price_detail" array.

2 - Yes multiple documents and they are returning an array.

3 - I am using Pymongo

4 - The latest one, MongoDB 5.0.9 community

5 - You raised a good point here. As I’ m novice to Mongodb world, I designed the schema based on my “understanding”. But basically, I want to build a webapp that give the ability to the end user to:

  • Based on the user location and fuel type, choose the cheapest gaz price around
  • Display the latest fuel price based on his/her location
  • Display the fuel price trend whether it s up or down.

The data provided are from an OpenData website in xml format and are refreshed every 10 minutes. Since I want to keep track of the fuel prices for each station_ID, I came up with this schema design. In a nutshell, I have 2 collections, one for the station information as below:

and the second one for the fuel prices per station

At the end of the day I’m not sure to have the right approach…