Home

Awesome

level-mongo

build status Windows Build Status Current Version dependency Status devDependency Status Coveralls

A basic mongo query interface for leveldb backend, future version will try to allow more advanced querying and partial & full updates

Install

$ npm install level-mongo --save

Usage

Valid options for constructor object exposed by module are shown below

options:


'use strict';

const LevelMongo = require('level-mongo');

const db = new LevelMongo({
   config: {
       keyEncoding: 'ascii',
       compression: false,
       cacheSize: 4 * 1024 * 1024
   },
   collections: {
       users: {
           key: '_id'
       }
   },
   location: './db'
});

db.open((err) => {

   db.collections.users.findOne({ _id: 'abcd'}, (err, doc) => {

       console.log(err, doc);

       db.close((err) => {

           console.log(err);

       });
   });

});

Mongo methods partially implemented on each collection object

TODO