Jeder sollte diesen Quelllink verwenden:
http://mongodb.github.com/node-mongodb-native/contents.html
Antwort auf die Frage:
var Db = require('mongodb').Db,
MongoClient = require('mongodb').MongoClient,
Server = require('mongodb').Server,
ReplSetServers = require('mongodb').ReplSetServers,
ObjectID = require('mongodb').ObjectID,
Binary = require('mongodb').Binary,
GridStore = require('mongodb').GridStore,
Code = require('mongodb').Code,
BSON = require('mongodb').pure().BSON,
assert = require('assert');
var db = new Db('integration_tests', new Server("127.0.0.1", 27017,
{auto_reconnect: false, poolSize: 4}), {w:0, native_parser: false});
db.open(function(err, db) {
assert.equal(null, err);
db.addUser('user', 'name', function(err, result) {
assert.equal(null, err);
db.authenticate('user', 'name', function(err, result) {
assert.equal(true, result);
db.close();
});
});
});