I want to migrate data from regular collection to timeseries collection, I am following this instruction: https://www.mongodb.com/docs/manual/core/timeseries/timeseries-migrate-data-into-timeseries-collection/
Step 1: Create a new timeseries collection (weather_timeseries
)
Step 2: Use aggregate with $out operation to transform data to timeseries structure, store to weather_temporary
collection
Step 3: Use mongo dump to export data from weather_temporary
to weather_temporary.bson
file
Step 4: Use mongo restore to import data from weather_temporary.bson
to weather_timeseries
collection
Step 1, 2, 3 works well. The problem in step 4.
It ran about 11% then show a error and stop processing.
Error message: Failed: test.weather_timeseries: error restoring from timeseries/test/weather_timeseries.bson: bulk write exception: write errors: [E11000 duplicate key error collection: test.system.buckets.weather_timeseries dup key: { _id: ObjectId(‘xxxxxxxxx’) }]
as I know, test.system.buckets
is system collection has managed by mongo, each data insert to weather_timeseries
, the data will be aggregated into system.buckets
. And _id in buckets is generated by mongo as well. I don’t know how this error can be happened