Mongorestore fails on TTL Index Creation

I wonder how it was even created on an existing collection but now I can’t seem to restore it.

This is how i see it in original database
{ "v" : 2, "key" : { "lo_oat" : 1 }, "name" : "lo_oat", "background" : "true", "sparse" : false, "expireAfterSeconds" : "3600", "ns" : "something.inside.namespace" },
Error message from mongorestore.log says:
2023-09-29T11:08:02.231+0000 Failed: something.inside.namespace: error creating indexes for something.inside.namespace: createIndex error: (CannotCreateIndex) TTL index 'expireAfterSeconds' option must be numeric, but received a type of 'string'. Index spec: { key: { lo_oat: 1 }, name: "lo_oat_1", background: "true", sparse: false, expireAfterSeconds: "3600", ns: "something.inside.namespace" }
Created and restored on same version: v4.2.23

Has this database got a longer lineage? As recently as 4.0 an invalid TTL index could be created.

The server log is probably full of TTLMonitor Errors.

If it is not used for anything else drop it and create it anew. You could update the metadata in the dump too, when it is restored it will have the correct TTL.

Note that if the TTL is invalid and there are many documents that are expired when the TTL job runs after correcting it you might see a lot of deletes/load on the server.