Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/javiercbk/naive-mongo
A naive mongo db driver implementation that mocks a mongodb database.
https://github.com/javiercbk/naive-mongo
Last synced: 28 days ago
JSON representation
A naive mongo db driver implementation that mocks a mongodb database.
- Host: GitHub
- URL: https://github.com/javiercbk/naive-mongo
- Owner: javiercbk
- License: mit
- Created: 2017-09-20T03:13:36.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-26T17:33:46.000Z (over 6 years ago)
- Last Synced: 2024-11-14T09:43:42.050Z (about 1 month ago)
- Language: JavaScript
- Size: 106 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![version](https://img.shields.io/npm/v/naive-mongo.svg)](https://www.npmjs.org/package/naive-mongo)
[![Build Status](https://travis-ci.org/javiercbk/naive-mongo.svg?branch=master)](https://travis-ci.org/javiercbk/naive-mongo)
[![npm](https://img.shields.io/npm/dt/naive-mongo.svg)](https://www.npmjs.org/package/naive-mongo)
[![Coverage Status](https://coveralls.io/repos/github/javiercbk/naive-mongo/badge.svg?branch=master)](https://coveralls.io/github/javiercbk/naive-mongo?branch=master)
# Naive MongoA naive mongodb driver that simulates a mongodb in-memory server.
## Goals & features
This library is a naive (array based) mongodb implementation. It does as little as possible to get the job done (meaning no optimizations whatsoever).
It implements nearly all collection's methods of the [mongodb native driver](http://mongodb.github.io/node-mongodb-native/2.2/api/), thus it can be used along mongoose as well.
It supports:
* Aggregation (Not all options)
* Queries (Most conditions).
* Updates (All operations but not all options).
* Insertions (Not all options).It does not support:
* `$text` searches.
This library is not checking paramenters YET, a misplaced parameter might result in an error.
## Usage
```js
const { MongoClient } = require('naive-mongo');
MongoClient.connect(`mongodb://some.nasty.fake.host:8080/test`, ((err, db) => {
const collection = db.collection('sample')
collection.insert({ nice: true }).then((newDoc) => {
console.log(newDoc);
}).catch((insertError) => {
console.log(insertError);
});
});
```## Why would you use this?
* Unit testing
* Mocking an API## Is it performant?
This library isn't supposed to be performant, but a simple mongodb implementation to make quick and dirty queries.
## Version number
The version number matches the MAJOR.MINOR version of mongo driver.
## Query engine
The query engine is based in [mingo](https://github.com/kofrasa/mingo).
## LICENSE
MIT