NOTICE: This project is currently experimental and may not work properly!
MongoData
DataAPI.
A lightweight wrapper around MongoDB's
Key Features
- Made for Deno
- works with Deno Deploy
- Pure Typescript
- Lightweight
- Zero dependencies
How To Use
import { DataAPI } from 'https://deno.land/x/mongodata/mod.ts';
const api = new DataAPI({
appId: '<APP ID>',
dataSource: '<CLUSTER NAME>',
key: '<API KEY>',
});
const database = api.getDatabase('<DATABASE>');
const collection = database.getCollection('<COLLECTION>');
const doc = { name: 'Bob', age: 30 };
console.log(await collection.insertOne({ document: doc }));
// 0123456789abcdef01234567
console.log(await collection.findOne({ filter: { name: 'Bob' } }));
// { _id: "0123456789abcdef01234567", name: "Bob", age: 30 }
console.log(await collection.deleteOne({ filter: { name: 'Bob' } }));
// { deletedCount: 1 }
Known issues
- [WIP] Currently you can not query BSON types (like ObjectIds)!
Contributing
Feel free to send merge requests!
You may also like...
- deno_mongo - MongoDB database driver developed for Deno.
License
MIT