Recover Old Versions from History Store
When history store survives in a directory copy, use PDU to read old collection versions. Full values and reverse modifications have different dependencies. The following sections describe initialization, scanning and export in detail.
I. Initialization
MONGODBDATA=/recovery-input/mongodb/source/dbpathparam sourceversion 8.0.0;
param sourcekind copy;
param sourcefrozen true;
param resmode history;b;
ds catalog status;
use appdb;Create new tasks for old-schema cases rather than rereading sources to upgrade indexes during resume.
II. Scan History Store
ds hs scan appdb.orders;
# Or select a database:
ds hs scan db appdb;Complete STANDARD old values can be extracted directly. MODIFY requires a newer base for the same record and a complete modification chain. Reverse modification requires an explicit source ABI declaration.
param hssourceabi le64;III. Export Old Versions
ds hs unload appdb.orders;
ds hs unload db appdb update;delete/update filtering depends on operation evidence established by the selected path. Historical documents can survive missing collection sources while operation classification remains unproven. Physical-version counts are not unique business-record counts.
IV. Handle Partial Page Loss
Independent branches confirmed by valid parent references can continue recovery. Versions missing bases or intermediate chains remain UNRESOLVED, and version counts inside missing pages remain unknown. HS_SOURCE_PARTIAL means partial sources, not complete success.
V. Continue the Recovery Task
Keep the original case and repeat the original command. Use discard-active only after deciding to abandon an unfinished output unit. Keep the namespace and filter type unchanged.
ds hs discard-active appdb.orders update;Retain native success, failure, unresolved dependencies, original errors and checkpoints. Completed-run resume reads native records and file metadata without checking exported content for counts, JSON, UTF-8, hashes, redecoding or trial import.
Output Files
Old versions are exported as BSON or Canonical Extended JSON, with source units and dependency reasons in native records. Confirm incident time and business-operation attribution using additional evidence.