Legacy documents in CONNECTIVITY_PARAMS_FOR_RACES_TO_BE_RESTORED stored the raw
paramURL including a random=<nonce> query parameter. Current keying (via
TracTracRaceTrackerImpl.getParamURLStrippedOfRandomParam) writes and deletes
using the paramURL stripped of that nonce, so the raw legacy copies can never be
matched by replaceOne/deleteOne. They linger indefinitely, inflate the restore
queue, and are re-attempted on every server start.
This mongosh migration auto-discovers every database in a replica set, skips
those without the collection, and for each nonce-bearing document either deletes
it (when a stripped twin already exists) or strips the random= parameter in
place (when it is the only copy). Dry-run by default; APPLY=1 executes and first
copies each affected document into a per-DB _NONCE_BACKUP collection for
rollback.
Assisted-By: Claude Opus 4.8 (claude-opus-5-5)