javiercbk / naive-mongo

A naive mongo db driver implementation that mocks a mongodb database.
MIT License
2 stars 0 forks source link

version Build Status npm Coverage Status

Naive Mongo

A 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, thus it can be used along mongoose as well.

It supports:

It does not support:

This library is not checking paramenters YET, a misplaced parameter might result in an error.

Usage

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?

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.

LICENSE

MIT