{"id":31664012,"url":"https://github.com/knotbin/nozzle","last_synced_at":"2026-04-30T08:39:39.271Z","repository":{"id":309801309,"uuid":"1037574062","full_name":"knotbin/nozzle","owner":"knotbin","description":"A light, type-safe MongoDB ODM using Zod schemas","archived":false,"fork":false,"pushed_at":"2025-11-29T01:15:24.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-30T16:12:55.335Z","etag":null,"topics":["deno","mongodb","orm","typescript","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dev-shahed/mizzleorm","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/knotbin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-13T19:30:56.000Z","updated_at":"2025-11-29T01:15:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"acad21cc-4a8b-48d0-ac6a-ca4dac3b2493","html_url":"https://github.com/knotbin/nozzle","commit_stats":null,"previous_names":["knotbin/nozzle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/knotbin/nozzle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knotbin%2Fnozzle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knotbin%2Fnozzle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knotbin%2Fnozzle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knotbin%2Fnozzle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knotbin","download_url":"https://codeload.github.com/knotbin/nozzle/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knotbin%2Fnozzle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32459420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno","mongodb","orm","typescript","zod"],"created_at":"2025-10-07T20:53:13.045Z","updated_at":"2026-04-30T08:39:39.249Z","avatar_url":"https://github.com/knotbin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Nozzle**\n\nA lightweight, type-safe ODM for MongoDB in TypeScript\n\n\u003e **Note:** Nozzle requires MongoDB **4.2 or newer** and works best with the\n\u003e latest stable MongoDB server (6.x or newer) and the official\n\u003e [mongodb](https://www.npmjs.com/package/mongodb) Node.js driver (v6+).\n\n## ✨ Features\n\n- **Schema-first:** Define and validate collections using any schema validator\n  that supports [Standard Schema](https://standardschema.dev).\n- **Type-safe operations:** Auto-complete and strict typings for `insert`,\n  `find`, `update`, and `delete`.\n- **Minimal \u0026 modular:** No decorators or magic. Just clean, composable APIs.\n- **Built on MongoDB native driver:** Zero overhead with full control.\n\n---\n\n## 📦 Installation\n\n```bash\ndeno add jsr:@nozzle/nozzle\n```\n\n\u003e If you need to upgrade your local MongoDB server, see:\n\u003e https://www.mongodb.com/docs/manual/administration/install-community/\n\n---\n\n## 🚀 Quick Start\n\nExamples below use Zod but any schema validator that supports\n[Standard Schema](https://standardschema.dev) will work.\n\n### 1. Define a schema\n\n```ts\n// src/schemas/user.ts\nimport { z } from \"zod\";\n\nexport const userSchema = z.object({\n  name: z.string(),\n  email: z.email(),\n  age: z.number().int().positive().optional(),\n  createdAt: z.date().default(() =\u003e new Date()),\n});\n\nexport type User = z.infer\u003ctypeof userSchema\u003e;\n```\n\n---\n\n### 2. Initialize connection and model\n\n```ts\n// src/index.ts\nimport {\n  connect,\n  disconnect,\n  InferModel,\n  InsertType,\n  Model,\n} from \"@nozzle/nozzle\";\nimport { userSchema } from \"./schemas/user\";\nimport { ObjectId } from \"mongodb\"; // v6+ driver recommended\n\ntype User = InferModel\u003ctypeof userSchema\u003e;\ntype UserInsert = InsertType\u003ctypeof userSchema\u003e;\n\nasync function main() {\n  // Use the latest connection string format and options\n  await connect(\"mongodb://localhost:27017\", \"your_database_name\");\n  const UserModel = new Model(\"users\", userSchema);\n\n  // Your operations go here\n\n  await disconnect();\n}\n\nmain().catch(console.error);\n```\n\n---\n\n### 3. Perform operations\n\n```ts\n// Insert one\nconst newUser: UserInsert = {\n  name: \"John Doe\",\n  email: \"john.doe@example.com\",\n  age: 30,\n};\nconst insertResult = await UserModel.insertOne(newUser);\n\n// Find many\nconst users = await UserModel.find({ name: \"John Doe\" });\n\n// Find one\nconst found = await UserModel.findOne({\n  _id: new ObjectId(insertResult.insertedId),\n}); // ObjectId from mongodb v6+\n\n// Update\nawait UserModel.update({ name: \"John Doe\" }, { age: 31 });\n\n// Delete\nawait UserModel.delete({ name: \"John Doe\" });\n\n// Insert many\nawait UserModel.insertMany([\n  { name: \"Alice\", email: \"alice@example.com\", age: 25 },\n  { name: \"Bob\", email: \"bob@example.com\" },\n]);\n\n// Find by ID\nawait UserModel.findById(insertResult.insertedId);\n\n// Update one\nawait UserModel.updateOne({ name: \"Alice\" }, { age: 26 });\n\n// Replace one\nawait UserModel.replaceOne({ name: \"Bob\" }, {\n  name: \"Bob\",\n  email: \"bob@newmail.com\",\n  age: 22,\n});\n\n// Delete one\nawait UserModel.deleteOne({ name: \"Alice\" });\n\n// Count\nconst count = await UserModel.count({ age: { $gte: 18 } });\n\n// Aggregation\nconst aggregation = await UserModel.aggregate([\n  { $match: { age: { $gte: 18 } } },\n  { $group: { _id: null, avgAge: { $avg: \"$age\" } } },\n]);\n\n// Paginated query\nconst paginated = await UserModel.findPaginated(\n  { age: { $gte: 18 } },\n  { skip: 0, limit: 10, sort: { age: -1 } },\n);\n```\n\n---\n\n## 📄 License\n\nMIT — use it freely and contribute back if you'd like!\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknotbin%2Fnozzle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknotbin%2Fnozzle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknotbin%2Fnozzle/lists"}