Carabao-Mongo is a lightweight, TypeScript-first abstraction over the official MongoDB driver (v1.1.3). It provides strong typing, explicit CRUD operations, aggregation-based queries with joins via $lookup, UUID abstraction, multi-database support, and transaction support. Unlike ORMs, it avoids decorators and schema reflection, staying close to MongoDB concepts while reducing boilerplate. Release cadence is irregular; active development continues. Key differentiator: type-safe, explicit query API without magic, enabling easy fallback to native driver.
npm install carabao-mongoNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows connecting, inserting with unique constraint, querying with pagination metadata, and closing the connection.
Let the library generate `uuid` automatically, or pass a valid UUID string.
If you only need the documents, use `findSingleData` or destructure `datas` from `findMultipleData`.
Create a unique index in MongoDB before using `uniqueFields`, or handle potential duplicates manually.
Expect a string, not an object with `acknowledged` etc.
Use `await getCollection<T>('collectionName')` instead of `getCollection<T>('collectionName')`.Run `npm install carabao-mongo mongodb` to install both packages.
Update to version >=1.0.0. The method is `insertData` (not `insert` or `insertOne`).
Use `const collection = await getCollection<T>('name')`.Check the type definition: `QueryOptions` has `where`, `select`, `sort`, `limit`, `skip`, etc.