deno_mongo

deno_mongo is a MongoDB database driver developed for deno, based on rust's official mongodb library package.

tag Build Status license tag

Examples

import { init, MongoClient } from "https://deno.land/x/mongo/mod.ts";

// Initialize the plugin and specify the binary release version (because the binary currently has no idea how to associate the version in ts and the binary)
await init("0.1.0");

const client = new MongoClient();
client.connectWithUri("mongodb://localhost:27017");

const db = getClient().database("test");
const users = db.collection("users");

// insert
const insertId = await users.insertOne({
  username: "user1",
  password: "pass1"
});

// findOne
const user1 = await users.findOne({ _id: insertId });

// deleteOne
const deleteCount = await users.deleteOne({ _id: insertId });