Starting in MongoDB version 7.0, you can use the $out
aggregation stage to migrate data from an existing collection into a
time series collection.
Note
MongoDB does not guarantee output order when you use $out to
migrate data into a times series collection. To maintain order, sort
your data before you migrate with an aggregation pipeline.
For more information on additional considerations for migrating your data, see Best Practices for Time Series Collections.
Next Steps
If your original collection had secondary indexes, manually recreate them now.
If your time series collection includes timeField values before
1970-01-01T00:00:00.000Z or after 2038-01-19T03:14:07.000Z,
MongoDB logs a warning and disables some query optimizations that make
use of the internal clustered index. To regain query performance and
resolve the log warning, create a secondary index on the timeField.