1.0.23 • Published 8 years ago
bus-mongo v1.0.23
BUS-MONGO
BUS-MONGO is a mongodb client, it is more easy-to-use than mongodb-native, and more flexable than mongoose.
Documentation
Installation
$ npm install bus-mongo
Stability
current stable branch is master.
Overview
init
firstly ,we need to connect mongodb with the url.
var bus_mongo = require('bus-mongo');
var my_db = bus_mongo.init('mongodb://username:password@localhost:port/my_db');
if you have replicated sets, just add in url
var bus_mongo = require('bus-mongo');
var my_db = bus_mongo.init('mongodb://username:password@master-server:port, mongodb://username:password@slave-server:port/my-db-name');
get db
we can access the other db object after connect to the admin db of mongo
var my_db = bus_mongo.db('my-db-name');
get collection
we can access the collection of the db object.
var my_collection = my_db.collection('collection-name');
crud
we can do all the crud operations of the collection, for example:
my_collection.insert({test:1}, function(err){
if(err) console.log(err);
else console.log('success insert!');
});
more operations's docs in here
1.0.23
8 years ago
1.0.21
9 years ago
1.0.20
9 years ago
1.0.19
9 years ago
1.0.18
9 years ago
1.0.17
9 years ago
1.0.16
9 years ago
1.0.15
9 years ago
1.0.14
9 years ago
1.0.13
9 years ago
1.0.12
9 years ago
1.0.11
9 years ago
1.0.10
9 years ago
1.0.9
9 years ago
1.0.8
9 years ago
1.0.7
9 years ago
1.0.6
9 years ago
1.0.5
9 years ago
1.0.4
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago