Create collection for time-series using pymongo

Hello, fellow developers.

I am using python to connect to MongoDB. The data I want to store is according to a timestamp. Therefore, a timeseries collection would be perfect for such data. However, I could not find any method to create such collection. There is a workaround that I found which is to create such collection in mongoshell and use it in python. However, I would delete and re-create such collection multiple times during development. Therefore, I would like a complete python way to create a time series collection. Is there anyone could help me with this? A code snippet would be nice?

Hello @Lord_Knight, welcome to the MongoDB Community forum!

Here is a post with a similar question and replies:

Ahh, thank you for the reply. I don’t know why I missed that article when I searched for a solution of this issue. Thank you.