The TTLMonitor is responsible for removing expired documents from a collection with a TTL index. The expireAfterSeconds option is a numerical value that is used to calculate the expiration time for removing documents.
In 5.0 (see
SERVER-56676), the TTL Monitor was updated to handle values that fall outside the long long range. However, because BSONElement::safeNumberLong() returns 0 for NaN values, SERVER-56676 sets the TTL expiration so that documents are expired immediately.
In versions before 5.0, the handling of NaN values for the expireAfterSeconds field is platform-dependent.