v2.0.1 is a compatibility and documentation patch for the v2 TypeScript line. It preserves the v2.0.0 public package shape while tightening v1 smooth-upgrade behavior and aligning the published documentation with the current runtime.
- Model routing:
definition.collectionis now used as the actual MongoDB collection name, withdefinition.nameand the registered model name as fallbacks. - Model pool scope: Model connection metadata now routes through the configured pool and database when creating scoped collections.
- Model cache identity: Model instance cache keys include pool, database, registered model name, and actual collection name to avoid cross-scope reuse.
- Populate compatibility:
relations.fromresolves registered Model names to their actual MongoDB collection names, while still allowing direct collection names when no registered Model exists. - Automatic indexes: Model index creation is deduplicated per runtime / pool / database / collection / index fingerprint; pending and fulfilled tasks are reused, while failed tasks may retry.
- Cache compatibility: Runtime cache option normalization preserves v1 aliases and millisecond TTL semantics.
- Pool compatibility: Pool selector operation names accept v1-style string inputs.
- Added
ModelDefinition.collectionandModelDefinition.nameto the public type surface. - Documented the actual automatic-index flow:
connect()only registers models;ModelInstancecreation schedules per-indexcreateIndex()calls; nolistIndexes()preflight is performed. - Updated the current release status, API index count, examples count, and advanced capability index entries.
- Kept historical changelog archive links unchanged; current published package links remain clean.
npm run buildnpm run type-checknpm run lintnpm run test:runtimenpm run test:compatibilitynpm run check:sizes:strictnpm run test:examplesnpm pack --json --dry-run