Skip to content

@iamcalegari/mongoat / runTo

Function: runTo()

runTo(database, version, config): Promise<void>

Defined in: src/migrate/runner.ts:501

Same as runMigrations, but only applies pending migrations whose version is lexicographically <= version — lets a caller stop at a specific point in the migration history instead of always applying everything pending. Acquires and releases the same exclusive run lock as runMigrations, under the same ordering guarantees.

Same as runMigrations — the topology precondition runs once, before the apply loop, and propagates REPLICA_SET_REQUIRED unwrapped.

Parameters

database

Database

A connected Database instance.

version

string

The last version (inclusive) to apply, YYYYMMDDHHMMSS.

config

MigrateConfig

Migration directory, control collection name, the allowNoTransaction opt-in, an optional lockTtlMs, and an optional graceful-stop signal.

Returns

Promise<void>