Novo is a simple Object Data Modeling (ODM) for MongoDB. Novo is created for your Mongodb project in Deno. It's easy to use and blazingly fast.
Working further for Query Class.
You can run this example with:
deno task example
// example/models/movie.model.ts
import {
novo,
ObjectId,
} from "https://raw.githubusercontent.com/NovqiGarrix/novo/main/mod.ts";
interface IMovieModel {
_id: ObjectId;
slug: string;
title: string;
poster: string;
createdAt: string;
updatedAt: string;
}
// "movies" is the collection name
const MovieModel = novo.model<IMovieModel>("movies");
export default MovieModel;
import { novo } from "https://raw.githubusercontent.com/NovqiGarrix/novo/main/mod.ts";
import MovieModel from "./models/movie.model.ts";
await novo.connect("mongodb://localhost:27017/movies");
const avengerEndGame = await MovieModel.findOne({
slug: "avg-endgame",
});
console.log(`-- ${avengerEndGame?.title} --`);
console.log(avengerEndGame);
globalThis.addEventListener("unload", () => {
/** Disconnect from database when deno is about to exit.
* NOTE: This action is required.
*/
novo.disconnect();
});
Deno.exit(0);
To run the unit tests:
deno task test
Hey, Developers. I'm glad if we're working together on this project.