Merge pull request #35432 from overleaf/em-change-library-mongo-cluster-migration-script

Copy library collections to the auxiliary Mongo cluster

GitOrigin-RevId: 87c0433b4345fdaa3fe3c141af888eaa0106ea45
This commit is contained in:
Eric Mc Sween
2026-09-17 11:26:16 +00:00
committed by Copybot
parent dd53057708
commit 235685aa61
@@ -254,6 +254,18 @@ export async function getCollectionInternal(name) {
return internalDb.collection(name)
}
/**
* Direct access to a collection on the auxiliary Mongo cluster, bypassing
* the dual-write mirror in `db`. For use by data-migration scripts that need
* to write to the auxiliary cluster without also writing to the primary one.
*/
export async function getAuxCollectionInternal(name) {
if (!auxInternalDb) {
throw new OError('no auxiliary Mongo cluster configured')
}
return auxInternalDb.collection(name)
}
export async function waitForDb() {
await connectionPromise
await auxConnectionPromise