···23## 📦 Installation
2425```bash
26-npm install mizzleorm mongodb zod
27-# or
28-yarn add mizzleorm mongodb zod
29```
3031> If you need to upgrade your local MongoDB server, see:
···23## 📦 Installation
2425```bash
26+deno add jsr:@nozzle/db
0027```
2829> If you need to upgrade your local MongoDB server, see:
···1import { z } from "zod";
02import {
3 connect,
4 defineModel,
5 disconnect,
6- InferModel,
7- InsertType,
8- MongoModel,
9-} from "../src";
10-import { ObjectId } from "mongodb";
1112// 1. Define your schema using Zod
13const userSchema = defineModel(z.object({
···24async function runExample() {
25 try {
26 // 3. Connect to MongoDB
27- await connect("mongodb://localhost:27017", "mizzleorm_example");
28 console.log("Connected to MongoDB");
2930- // 2. Create a MongoModel for your collection
31- const UserModel = new MongoModel("users", userSchema);
3233 // Clean up previous data
34 await UserModel.delete({});
···76 }
77}
7879-runExample();
000
···1import { z } from "zod";
2+import { ObjectId } from "mongodb";
3import {
4 connect,
5 defineModel,
6 disconnect,
7+ type InferModel,
8+ type InsertType,
9+ Model,
10+} from "../mod.ts";
01112// 1. Define your schema using Zod
13const userSchema = defineModel(z.object({
···24async function runExample() {
25 try {
26 // 3. Connect to MongoDB
27+ await connect("mongodb://localhost:27017", "nozzle_example");
28 console.log("Connected to MongoDB");
2930+ // 2. Create a Model for your collection
31+ const UserModel = new Model("users", userSchema);
3233 // Clean up previous data
34 await UserModel.delete({});
···76 }
77}
7879+// Only run the example if this is the main module
80+if (import.meta.main) {
81+ runExample();
82+}