Convert from a Time Series Collection back to a regular collection

(using mongo utilities 100.9.3 on Mongo6) Is there any simple way to convert an existing timeseries collection to a regular collection? It would be ideal to dump/restore the same collection to the same database, but just remap it (the collection) to a new name…then when I catch up, drop the timeseries collection and rename the one I just populated. I did try using nsFrom/To and ran into problems (where the namespace already exists and so on). I did finally use mongoexport and piped that to mongoimport, but that is going to take a long…long time with nearly 2TB of data, so I’m just soliciting ideas at this point. Just one other question, when I use mongodump, I obviously can’t just use the timeseries UTC date because it required the meta-data field(only?)…which is basically an ID field, so I kind of wondered how that was going to work; can I do a regex on a metafield to say give me anything AND then use a UTC date at the end to do my date query?

Have you looked at an aggregation pipeline with the $out stage?

Thanks Artur, actually, that didn’t cross my mind. That looks like an interesting solution to several different types of problems. Very cool.

1 Like