15 lines
398 B
TypeScript
15 lines
398 B
TypeScript
import { MongoClient, MongoClientOptions } from "mongodb";
|
|
import { z } from "zod";
|
|
|
|
// mongodb ObjectId as zod schema (we'll settle on our definition later)
|
|
export const ObjectId = z.any();
|
|
|
|
export async function createMongoClient(url: string, options?: MongoClientOptions) {
|
|
try {
|
|
return new MongoClient(url, options);
|
|
} catch(e) {
|
|
console.log(e);
|
|
return;
|
|
}
|
|
}
|