Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80180

Time Series Collection

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Server Triage
    • ALL
    • Hide

      db.createCollection(
          "weather27h1",
          {
             timeseries:

      {           timeField: "timestamp",           metaField: "metadata",           granularity: "hours"        }

      ,
             expireAfterSeconds: 86400
          }
      )
       
      db.weather27h1.insertMany( [
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-10T00:00:00.000Z"),
            "temp": 12
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-10T04:00:00.000Z"),
            "temp": 11
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-10T08:00:00.000Z"),
            "temp": 11
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-10T12:00:00.000Z"),
            "temp": 12
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-10T16:00:00.000Z"),
            "temp": 16
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-17T20:00:00.000Z"),
            "temp": 15
         },

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T00:00:00.000Z"),
            "temp": 13
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T04:00:00.000Z"),
            "temp": 12
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T08:00:00.000Z"),
            "temp": 11
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T12:00:00.000Z"),
            "temp": 12
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T16:00:00.000Z"),
            "temp": 17
         },
         

      {       "metadata": \{ "sensorId": 5578, "type": "temperature" }

      ,
            "timestamp": ISODate("2023-08-19T20:00:00.000Z"),
            "temp": 12
         }
      ] )
       
       

      Show
      db.createCollection(     "weather27h1",     {        timeseries: {           timeField: "timestamp",           metaField: "metadata",           granularity: "hours"        } ,        expireAfterSeconds: 86400     } )   db.weather27h1.insertMany( [     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-10T00:00:00.000Z"),       "temp": 12    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-10T04:00:00.000Z"),       "temp": 11    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-10T08:00:00.000Z"),       "temp": 11    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-10T12:00:00.000Z"),       "temp": 12    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-10T16:00:00.000Z"),       "temp": 16    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-17T20:00:00.000Z"),       "temp": 15    }, {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T00:00:00.000Z"),       "temp": 13    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T04:00:00.000Z"),       "temp": 12    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T08:00:00.000Z"),       "temp": 11    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T12:00:00.000Z"),       "temp": 12    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T16:00:00.000Z"),       "temp": 17    },     {       "metadata": \{ "sensorId": 5578, "type": "temperature" } ,       "timestamp": ISODate("2023-08-19T20:00:00.000Z"),       "temp": 12    } ] )    

      Hi all,

         I met a strange about the time series collection . MongoDB version 5.0.18 and i create a time series collection with Expire property but when the time is come we see that document did not removed. Current date is ISODate("2023-08-17T06:53:03.288Z"), but you can see in the pic the data with timestamp ISODate("2023-08-10T00:00:00Z") was not removed and still exists. Who can tell me why 

       

         

        1. image-2023-08-17-14-53-46-724.png
          image-2023-08-17-14-53-46-724.png
          346 kB
        2. weather27h1
          2 kB

            Assignee:
            backlog-server-triage [HELP ONLY] Backlog - Triage Team
            Reporter:
            aaa15942975658@163.com zhijia zhang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: