Updating a time-series meta but the buckets are not update

Hi there.

I’m using time-series collection to store the measurements of a sensor.
I have a collection in which I store the avarage values of one hour of measuraments.
In order to valorized the current hour I insert every 10 minutes a temporary row with the partial values. My Meta is an object and one of its properties is “bool TemporaryTimeSeries”. When TemporaryTimeSeries is true the time-series with the partial values will be deleted by the logic of the program. I do not perform an update because I can’t update values or time stamp of a time-series. To reach the same result I delete the temporary time series that will be replaced with the updated one. Once the hour change i perform an update on the time-series with TemporaryTimeSeries at true, setting it to false.

Here an example of a time-series that i am working with

  "Value": 5.3,
  "TimeStamp": "2023-08-22T12:34:56Z",
  "Meta": {
    "DeviceId": "ID123",
    "SensorId": "Sensor456",
    "TemporaryTimeSeries": true

The problem is that when I update TsTemporary to false MongoDb does not update the buckets structures even if the Meta is the same.
What happen is that I have different buckets with the same Meta.
That’s lead me to have as many bucket as the time-series that i collected.

Is this behavior fixable?
If not what can i do?


Hey @Michele_Bandini,

Welcome to the MongoDB Community!

Let me see if I understand the issue - it sounds like when you update the "metadata.TemporaryTimeSeries" field to false in your time series collection, the change is not reflected in your bucket collection structure.

If yes then - as of now, we don’t have the functionality to merge buckets in our internal collections. If this functionality is important to you, I recommend you to submit feedback through our MongoDB Feedback Engine

However, the internal system bucket documents are for internal use only and are subject to change. For most use cases, you only need to interact with the time series collection itself rather than the underlying bucket structure.

Please let us know if you have any other questions.


1 Like