Thin MongoDB ODM built for Standard Schema
mongodb
zod
deno
1import type { StandardSchemaV1 } from "@standard-schema/spec";
2import type { ObjectId } from "mongodb";
3
4type Schema = StandardSchemaV1<unknown, Record<string, unknown>>;
5type Infer<T extends Schema> = StandardSchemaV1.InferOutput<T>;
6
7export type InferModel<T extends Schema> = Infer<T> & {
8 _id?: ObjectId;
9};
10
11export type InsertType<T extends Schema> = Omit<Infer<T>, "createdAt"> & {
12 createdAt?: Date;
13};