2.0.0 • Published 6 years ago

dbstream-mongo v2.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

dbstream-mongo

Mongo DB access layer compatible with the dbstream API

Usage

var db = require( "dbstream-mongo" );
var connection = db.connect( "mongodb://127.0.0.1:27017/test", { collection: "test" } );

// write or update
var cursor = new connection.Cursor()
cursor.write({ id: 1, name: "Hello" });
cursor.write({ id: 2, name: "World" });
cursor.on("finish", function() {
  console.log("Saved 2 objects");
});
cursor.end();

// read
new connection.Cursor()
  .find({ id: 2 })
  .limit( 1 )
  .on("data", function (obj) {
    console.log("Loaded", obj);
  });

API

This module implements the dbstream API. For the complete documention see: https://github.com/avinoamr/dbstream

connect( url, options )
  • url a mongodb connection url string
  • options standard mongodb connection options, plus a collection name key
  • Returns a dbstream Connection object

Creates a MongoDB connection. Uses the MongoClient.connect arguments.

2.0.0

6 years ago

1.4.1

7 years ago

1.4.0

7 years ago

1.3.11

8 years ago

1.3.10

8 years ago

1.3.9

8 years ago

1.3.8

9 years ago

1.3.6

9 years ago

1.3.5

9 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.2.1

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago