Problem Statement/Rationale
Mongorestore has the CLI option --bypassDocumentValidation. This CLI option currently only applies to the bulkWriter, but applying oplogs can still fail with document validation error, which is shown as an UnknownError from applyOps:
Failed: restore error: error applying oplog: applyOps: (UnknownError) applyOps had one or more errors applying ops
Steps to Reproduce
- Set up a source collection with validator and insert "invalid" documents to that collection bypassing validation.
- Run mongodump to dump the oplogs.
- Run mongorestore with the CLI option to bypassDocumentValidation.
Expected Results
Mongorestore with bypassDocumentValidation should succeed restoring the oplogs.
Actual Results
Mongorestore fails with an UnknownError when applying the oplogs.
Additional Notes
Found by the passthrough test failure (link).