Recover Pre-Image Old Documents

When a collection retains pre-images with matching catalog and oplog, use PDU to extract old documents from before operations. The following sections describe scanning, operation ranges and incomplete transaction sources.


I. Initialization

MONGODBDATA=/recovery-input/mongodb/source/dbpath
param sourceversion 8.0.0;
param sourcekind copy;
param sourcefrozen true;
param resmode history;
b;
ds catalog status;

In directory mode, the catalog links pre-images to target collections by UUID. If oplog is missing, save the complete old documents and keep operation types unknown. Do not classify every old value as a deletion or update.


II. Scan Old Documents

ds preimage scan appdb.orders;
ds preimage scan db appdb update;

III. Set an Operation Range (Optional)

param operationfrom 1700000000:1;
param operationbefore 1700000010:1;
ds preimage scan appdb.orders update;

Replace example values with actual source timestamps. Ranges use source logical operation/commit timestamps, with an inclusive start and exclusive end in SECONDS:INCREMENT format. They are not business Date fields or incident wall-clock time.


IV. Export Attributable Old Values

ds preimage unload appdb.orders update;
param operationfrom none;
param operationbefore none;

Ordinary operations and members of complete, unique SOURCE transaction commit chains can enter matching filters. Retain old documents and reasons for open, aborted, incomplete or ambiguous transactions without forcing a committed business-operation classification.


V. Handle Missing Pages and Active Units

For damaged pages, PDU keeps readable branches and records PREIMAGE_SOURCE_PARTIAL. Complete, unaffected source chains can still be filtered; incomplete members remain unknown. Run the following command only after deciding to abandon an unfinished output unit.

ds preimage discard-active appdb.orders update;

Output Files

Results are offline old-document candidates without automatic target-collection updates. Retain UUID, source relationships, filter ranges and unresolved transaction reasons.

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.

MongoDB 文档