Sync one MongoDB collection to another MongoDB collection, supporting change streams and initial scans. Current stable version is 0.40.0, with regular releases. Requires Node >=16, peer dependencies include ioredis and mongodb (>=6.8.0). Key differentiators: built-in support for field omission, event-driven progress tracking, and batched initial sync with configurable batch sizes. Ships TypeScript types.
npm install mongo2mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize sync between two MongoDB collections with Redis, listen to events, start change stream and initial scan.
Update mongodb to >=6.8.0 and ioredis to >=5.4.1.
Upgrade Node.js to 16 or later.
Attach event listeners immediately after initSync.
Check future releases for alternative API.
Use separate MongoClient instances if needed, or connect to the same client with different databases.
Change import to named import: import { initSync } from 'mongo2mongo'.Run npm install mongo2mongo or ensure package.json has 'type': 'module'.
Use named import: import { initSync } from 'mongo2mongo'.Install compatible versions: npm install ioredis@5.4.1 mongodb@6.8.0
Ensure you call initSync and use the returned sync object.