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
## ๐ฆ Installation
24
25
```bash
26
-
deno add jsr:@nozzle/db
27
```
28
29
> If you need to upgrade your local MongoDB server, see:
···
42
43
export const userSchema = z.object({
44
name: z.string(),
45
-
email: z.string().email(),
46
age: z.number().int().positive().optional(),
47
createdAt: z.date().default(() => new Date()),
48
});
···
62
InferModel,
63
InsertType,
64
MongoModel,
65
-
} from "mizzleorm";
66
import { userSchema } from "./schemas/user";
67
import { ObjectId } from "mongodb"; // v6+ driver recommended
68
···
145
{ age: { $gte: 18 } },
146
{ skip: 0, limit: 10, sort: { age: -1 } },
147
);
148
-
```
149
-
150
-
---
151
-
152
-
## ๐ง Project Structure
153
-
154
-
```
155
-
mizzleorm/
156
-
โโโ src/
157
-
โ โโโ schema.ts # Schema definition utility
158
-
โ โโโ model.ts # MongoModel wrapper
159
-
โ โโโ client.ts # MongoDB client connection
160
-
โ โโโ index.ts # Public API exports
161
-
โโโ examples/ # Example usage files
162
-
โ โโโ user.ts
163
-
โโโ tests/ # Unit and integration tests
164
-
โโโ package.json
165
-
โโโ tsconfig.json
166
-
โโโ README.md
167
-
```
168
-
169
-
---
170
-
171
-
## ๐ Development
172
-
173
-
### Build the library:
174
-
175
-
```bash
176
-
npm run build
177
-
```
178
-
179
-
### Run the example:
180
-
181
-
```bash
182
-
npm run example
183
```
184
185
---
···
23
## ๐ฆ Installation
24
25
```bash
26
+
deno add jsr:@nozzle/nozzle
27
```
28
29
> If you need to upgrade your local MongoDB server, see:
···
42
43
export const userSchema = z.object({
44
name: z.string(),
45
+
email: z.email(),
46
age: z.number().int().positive().optional(),
47
createdAt: z.date().default(() => new Date()),
48
});
···
62
InferModel,
63
InsertType,
64
MongoModel,
65
+
} from "@nozzle/nozzle";
66
import { userSchema } from "./schemas/user";
67
import { ObjectId } from "mongodb"; // v6+ driver recommended
68
···
145
{ age: { $gte: 18 } },
146
{ skip: 0, limit: 10, sort: { age: -1 } },
147
);
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
148
```
149
150
---
+1
-1
examples/user.ts
···
11
// 1. Define your schema using Zod
12
const userSchema = z.object({
13
name: z.string(),
14
-
email: z.string().email(),
15
age: z.number().int().positive().optional(),
16
createdAt: z.date().default(() => new Date()),
17
});
···
11
// 1. Define your schema using Zod
12
const userSchema = z.object({
13
name: z.string(),
14
+
email: z.email(),
15
age: z.number().int().positive().optional(),
16
createdAt: z.date().default(() => new Date()),
17
});