Git Product home page Git Product logo

mongodown's Introduction

MongoDOWN

A drop-in replacement for LevelDOWN that runs on MongoDB. Can be used as a back-end for LevelUP rather than an actual LevelDB store.

Build Status

Installation

npm install mongodown

Example

var levelup = require('levelup')
var mongodown = require('mongodown')

// MongoDB Collection name defaults to 'mongodown'
var db = levelup(mongodown('localhost/my-database'))

// OR pass custom MongoDB collection name
db = levelup(mongodown('localhost/my-database'), { collection:'People_C' })

db.put('name', 'Yuri Irsenovich Kim')
db.put('dob', '16 February 1941')
db.put('spouse', 'Kim Young-sook')
db.put('occupation', 'Clown')

db.readStream()
  .on('data', console.log)
  .on('close', function () { console.log('Show\'s over folks!') })

Limitations

MongoDOWN does not support iterator snapshots

License

MIT

mongodown's People

Contributors

davidguttman avatar dmitryverkhovtsev avatar kreozot avatar ralphtheninja avatar tejzpr avatar watson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mongodown's Issues

Auth issues when creating databases in MongoLab

var levelup = require('levelup')
var mongodown = require('mongodown')
var db = levelup('myuser:[email protected]:53798/pliplu', {db: mongodown})
db.put('key', 'value')

Should create a dabatase and put a document in it, right? But it doesn't. It fails with a MongoError: auth failed.

Everything works if I precreate the database in the MongoLab console, but I cannot make mongodown create the databases for me.

I don't understand the workings of MongoDB, so this is maybe a stupid question, but thank you for the help.

howdy: tests passing, passing options?

Howdy,

I have a situation where I already have a mongo connection db and collection instances, and would like to try out mongodown as a way to introduce the code to the levelup ecosystem.

I added a few lines to attempt re-using {conn: <mongojs.connect( )>, collection: 'mycollection'} as options, but got snagged when I couldn't get tests to pass before or after my changes. Any advice? Should I comment out some tests?

Configurable collection name

Hi,

I'm looking to use this package as part of some framework code and I think it would be useful to be able to set the collection name as part of the constructor. Is that behaviour that you'd be interested in?

I can't get the example to work (nor to put any documents to the MongoLab)

I tried to run the example at the readme:

var levelup = require('levelup');
var db = levelup('localhost/my-database', { db: require('mongodown') });

db.put('name', 'Yuri Irsenovich Kim')
db.put('dob', '16 February 1941')
db.put('spouse', 'Kim Young-sook')
db.put('occupation', 'Clown')

db.readStream()
  .on('data', console.log)
  .on('close', function () { console.log('Show\'s over folks!') })

But I only got "Show's over folks!".
Trying to manually .get any of the keys also didn't work.

Using MongoLab as my backend. Following the instructions at the mongojs readme, I placed my user and password along with the string in the way they describe there. I also precreated a collection named "mongodown" as I saw it was the default name mongodown was using.

I placed some console.logs at the .connect and .put code to see if they were being called correctly, and yes they were. Everything seemed fine, but I couldn't dig more.

During the whole process, I tried to inspect the error parameters in the callbacks, but they were undefined or {}.

My MongoLab dashboard also shows no document has been written.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.