Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yooneskh/yongo
Minimal MongoDB for Deno
https://github.com/yooneskh/yongo
Last synced: 25 days ago
JSON representation
Minimal MongoDB for Deno
- Host: GitHub
- URL: https://github.com/yooneskh/yongo
- Owner: yooneskh
- Created: 2021-06-22T18:15:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T09:51:13.000Z (5 months ago)
- Last Synced: 2024-08-04T00:05:23.706Z (4 months ago)
- Language: TypeScript
- Size: 28.3 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-deno - yongo - Subset of Mongoose api in deno (like populate) but will not fully copy mongoose (Modules / Database)
README
# Yongo
This project aims to be a very simple wrapper around deno_mongo driver for MongoDB database. Yongo is inspired by Mongoose in Node.js but will not try to implement all of its functionality.
## Installation
Yongo is hosted at
## Usage
Example usage is in `./examples` folder and is updated regularly to include every aspect.
Yongo works like this:
```typescript
import { connect, Query } from 'https://deno.land/x/yongo@LATEST_VERSION/mod.ts';await connect('mongo://host:port/dbname');
const query = new Query('collection');
query.where({ filter object });
query.projectIn('name');
query.projectOut('lastName');query.sort({ sort object });
query.populate({ path: 'owner', collection: 'users' });
await query.query();
await query.queryOne();
await query.count();// to create
const query = new Query('collection');
query.put('name', 'Yoones');
query.put('lastName', 'Khoshghadam');const insertedDocument = await query.insert();
// to change
const query = new Query('collection');
query.where({ name: 'Yoones' });
query.put('age', 26);await query.commit();
await query.commitMany();await query.delete();
await query.deleteMany();
```## Licensce
Free For All!