Error to update

I try update data

[{
    date: ISODate('2024-08-08T14:58:13.098Z'),
    text: 'fdgdgfdg',
    _id: ObjectId('66b4dd0565239f72c011cab7'),
    email: 'ploykas@gmail.com'
  },
  {
    date: ISODate('2024-08-08T15:27:18.292Z'),
    text: 'g5gtgrtg',
    _id: ObjectId('66b4e3d665239f72c011cab8'),
    email: 'ploykas@gmail.com'
  },
  {
    date: ISODate('2024-08-08T16:36:20.651Z'),
    text: 'sadas sdcfsdfd d wkjdnwd w dowiud we xwoi d d we dwpediwdipwepidcwe',
    _id: ObjectId('66b4f40465239f72c011cab9'),
    email: 'ploykas@gmail.com',
    reading: false
  }
]

I give this command

db.message.update({“_id”:ObjectId(‘66b4f40465239f72c011cab9’)},{$set:{“reading”:true}},{multi:true})

and I take error message

MongoServerError: Cannot perform an update on a time-series collection that does not have a metaField

Can You help me someobe?

Hi @Panos_Loukas and welcome to the community!
Is this a time series collection?
For do that check, you can run the following command:

Regards

1 Like

I deleted the collection and I created new and now is type: ‘collection’.
maybe it was timeseries type. Is it impossibility the update If the collection is typeseries type ?

Hi @Panos_Loukas,

From the error you were getting, it seems that the collection was not created with the required/optional fields:

From the documentation:

Regards