typed-mongo (v0.0.7) is a minimal, strongly-typed wrapper for the MongoDB Node.js driver that provides type inference for collection operations and declarative index management. Unlike ORMs like Mongoose, it adds negligible overhead and no custom schema definitions—just TypeScript types. Released under MIT, it requires Node >=22 and peer dependency mongodb ^6.0.0. Primary differentiators: zero-cost abstractions, automatic type safety for queries and projections, and index syncing without schema definitions.
npm install typed-mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize typed-mongo with a MongoDB client, define a type-safe schema, and perform basic insert and find operations.
Pass `{ ignoreUndefined: true }` to MongoClient constructor or ensure your documents do not contain undefined values.Upgrade Node.js to v22 or later.
Cast result manually or await future type improvements.
Use import syntax or dynamic import() in CommonJS projects.
Change to `import { TypedMongo } from 'typed-mongo'` or use dynamic `import('typed-mongo')`.Make the field optional in the type or provide a value.
Add the field to the schema type or remove it from the query.
Run `npm install mongodb@^6.0.0` to satisfy peer dependency.