tangled
alpha
login
or
join now
knotbin.com
/
nozzle
0
fork
atom
Thin MongoDB ODM built for Standard Schema
mongodb
zod
deno
0
fork
atom
overview
issues
pulls
pipelines
readme updates
knotbin.com
7 months ago
1b2aeb2c
ad13eec4
+4
-39
2 changed files
expand all
collapse all
unified
split
README.md
examples
user.ts
+3
-38
README.md
···
23
23
## 📦 Installation
24
24
25
25
```bash
26
26
-
deno add jsr:@nozzle/db
26
26
+
deno add jsr:@nozzle/nozzle
27
27
```
28
28
29
29
> If you need to upgrade your local MongoDB server, see:
···
42
42
43
43
export const userSchema = z.object({
44
44
name: z.string(),
45
45
-
email: z.string().email(),
45
45
+
email: z.email(),
46
46
age: z.number().int().positive().optional(),
47
47
createdAt: z.date().default(() => new Date()),
48
48
});
···
62
62
InferModel,
63
63
InsertType,
64
64
MongoModel,
65
65
-
} from "mizzleorm";
65
65
+
} from "@nozzle/nozzle";
66
66
import { userSchema } from "./schemas/user";
67
67
import { ObjectId } from "mongodb"; // v6+ driver recommended
68
68
···
145
145
{ age: { $gte: 18 } },
146
146
{ skip: 0, limit: 10, sort: { age: -1 } },
147
147
);
148
148
-
```
149
149
-
150
150
-
---
151
151
-
152
152
-
## 🧠 Project Structure
153
153
-
154
154
-
```
155
155
-
mizzleorm/
156
156
-
├── src/
157
157
-
│ ├── schema.ts # Schema definition utility
158
158
-
│ ├── model.ts # MongoModel wrapper
159
159
-
│ ├── client.ts # MongoDB client connection
160
160
-
│ └── index.ts # Public API exports
161
161
-
├── examples/ # Example usage files
162
162
-
│ └── user.ts
163
163
-
├── tests/ # Unit and integration tests
164
164
-
├── package.json
165
165
-
├── tsconfig.json
166
166
-
└── README.md
167
167
-
```
168
168
-
169
169
-
---
170
170
-
171
171
-
## 🛠 Development
172
172
-
173
173
-
### Build the library:
174
174
-
175
175
-
```bash
176
176
-
npm run build
177
177
-
```
178
178
-
179
179
-
### Run the example:
180
180
-
181
181
-
```bash
182
182
-
npm run example
183
148
```
184
149
185
150
---
+1
-1
examples/user.ts
···
11
11
// 1. Define your schema using Zod
12
12
const userSchema = z.object({
13
13
name: z.string(),
14
14
-
email: z.string().email(),
14
14
+
email: z.email(),
15
15
age: z.number().int().positive().optional(),
16
16
createdAt: z.date().default(() => new Date()),
17
17
});