-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
ALL
-
Storage Execution 2025-03-31, Storage Execution 2025-04-14, Storage Execution 2025-04-28, Storage Execution 2025-05-12, Storage Execution 2025-05-26
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
In plan, we observed a failed tenant upgrade during the mongorestore due to index creation failure. The customer was restoring a TTL index on a time-series collection with expireAfterSeconds, but the partialFilterExpression field was empty, resulting in:
createIndex error: (InvalidOptions) TTL indexes on time-series collections require a partialFilterExpression on the metaField
We'd like to understand better if this is a bug on the Server or if the Tools team needs to be able to support this in mongorestore. Thank you in advance!
Note: I was able to reproduce this locally by creating a new index on the Serverless instance using script:
const db = db.getSiblingDB("ttl_test_demo");db.getCollection("sensor_data").drop();db.createCollection("sensor_data", { timeseries: { timeField: "timestamp", metaField: "deviceId", granularity: "minutes" } });db.sensor_data.insertOne({ timestamp: new Date(), deviceId: "sensor-001", temperature: 22.5 });try { db.sensor_data.createIndex( { timestamp: 1 }, { name: "invalid_ttl_index", expireAfterSeconds: 3600, partialFilterExpression: {} } ); } catch (err) { print("❌ Failed to create invalid TTL index (as expected):"); print(err.message); }
which should succeed (as seen in screenshot).
I then mongodumped the cluster using:
mongodump \ --uri "mongodb+srv://serverlessinstance0.miywmo4.mongodb-qa.net/" \ --username <...> \ --password <...> \ --ssl \ --archive=dump.archive
and mongorestored to another cluster using:
mongorestore \ --uri "mongodb+srv://serverlessinstance1.hfa9lgk.mongodb-qa.net/" \ --username tw \ --password tw \--verbose 5 \ --ssl \ --archive=dump.archive \ --drop \ --convertLegacyIndexes \ --bypassDocumentValidation \ --numParallelCollections 4
resulting in the same error message:
2025-03-24T15:23:21.818-0400 Failed: ttl_test_demo.sensor_data: error creating indexes for ttl_test_demo.sensor_data: createIndex error: (InvalidOptions) TTL indexes on time-series collections require a partialFilterExpression on the metaField