Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add replicaset test cases. Invoke it by $ make test-replicaset

  • Loading branch information...
commit 0ce29306910ad27a6cd99e769a6de56bc39f7754 1 parent db8b584
@fengmk2 fengmk2 authored
View
2  .gitignore
@@ -1,3 +1,5 @@
node_modules
+data/
+deps/
coverage.html
lib-cov
View
26 Makefile
@@ -1,17 +1,31 @@
-TESTS = $(shell find test -type f -name "*.js")
-TESTTIMEOUT = 5000
+TESTS = test/
+TESTTIMEOUT = 60000
REPORTER = spec
+MOCHA_OPTS =
PROJECT_DIR = $(shell pwd)
+MONGOSKIN_REPLICASET = false
SUPPORT_VERSIONS := \
0.9.8 0.9.8-7 0.9.8-6 \
0.9.9 0.9.9-8 0.9.9-7 \
1.0.0 1.0.1 1.0.2 \
- 1.1.0-beta
+ 1.1.0-beta 1.1.1 1.1.2 1.1.3 1.1.4
test:
@npm install
- @NODE_ENV=test ./node_modules/mocha/bin/mocha \
- --reporter $(REPORTER) --timeout $(TESTTIMEOUT) $(TESTS)
+ @if ! test -d deps/mongodb; then \
+ git clone git://github.com/mongodb/node-mongodb-native.git deps/mongodb; \
+ fi
+ @cd deps/mongodb && npm install && git pull && cd ../..
+ @NODE_ENV=test MONGOSKIN_REPLICASET=$(MONGOSKIN_REPLICASET) \
+ ./node_modules/mocha/bin/mocha --recursive \
+ --reporter $(REPORTER) --timeout $(TESTTIMEOUT) \
+ $(MOCHA_OPTS) $(TESTS)
+
+test-debug:
+ @$(MAKE) test MOCHA_OPTS="--debug-brk"
+
+test-replicaset:
+ @$(MAKE) test MONGOSKIN_REPLICASET=true
lib-cov:
@rm -rf ./$@
@@ -29,4 +43,4 @@ test-version:
$(MAKE) test REPORTER=progress; \
done
-.PHONY: test test-cov lib-cov
+.PHONY: test-replicaset test-version test-cov test lib-cov
View
2  Readme.md
@@ -14,7 +14,7 @@ The api is same to node-mongodb-native, please see the [document](http://mongodb
* >= 0.9.8
* 1.0.x
-* (bug)1.1.x
+* 1.1.x
```bash
$ make test-version
View
49 lib/mongoskin/index.js
@@ -92,36 +92,39 @@ for (var key in mongo) {
* RepliSet: mongoskin.db(serverURLs, options)
*
* ```js
- * mongoskin.db(['192.168.0.1:27017/', '192.168.0.2/?auto_reconnect', '192.168.0.3'], { database: 'mydb' })
+ * mongoskin.db([
+ * '192.168.0.1:27017/',
+ * '192.168.0.2/?auto_reconnect',
+ * '192.168.0.3'
+ * ], {database: 'mydb'}, {connectArbiter: false});
* ```
*
* Single Server: mongoskin.db(dbURL, options)
*
* ```js
- * mongoskin.db('192.168.0.1:27017/mydb')
+ * mongoskin.db('192.168.0.1:27017/mydb');
+ * // or
+ * mongoskin.db('192.168.0.1:27017', {database: 'mydb'});
* ```
*
- * or
- *
- * ```js
- * mongoskin.db('192.168.0.1:27017', { database: 'mydb' })
- * ```
- *
- * @param {String} serverUrl
+ * @param {String|Array} serverUrl or server urls.
* @param {Object} [options]
+ * @param {Object} [replicasetOptions], options for replicaset.
+ * The detail of this options, please
+ * @see https://github.com/mongodb/node-mongodb-native/blob/master/lib/mongodb/connection/repl_set.js#L27.
* @return {SkinDb}
* @api public
*/
-exports.db = function (serverUrl, options) {
- options = options || {};
+exports.db = function (serverUrl, dbOptions, replicasetOptions) {
+ dbOptions = dbOptions || {};
var server, database, config;
if (Array.isArray(serverUrl)) {
- if (!options.database) {
- throw new Error('Please provide a database in options to connect.');
+ if (!dbOptions.database) {
+ throw new Error('Please provide a database in `dbOptions` to connect.');
}
- database = options.database;
+ database = dbOptions.database;
var len = serverUrl.length;
var servers = [];
@@ -132,24 +135,28 @@ exports.db = function (serverUrl, options) {
}
servers.push(new Server(config.host, config.port, config.options));
}
- server = new ReplSetServers(servers);
+ server = new ReplSetServers(servers, replicasetOptions);
} else {
config = parseUrl(serverUrl);
- database = options.database || config.database;
+ database = dbOptions.database || config.database;
if (!database) {
throw new Error('Please provide a database to connect to.');
}
-
+ var socketOptions = dbOptions.socketOptions;
+ if (socketOptions) {
+ delete dbOptions.socketOptions;
+ config.options.socketOptions = socketOptions;
+ }
server = new Server(config.host, config.port, config.options);
- if (options.username === undefined) {
- options.username = config.username;
- options.password = config.password;
+ if (dbOptions.username === undefined) {
+ dbOptions.username = config.username;
+ dbOptions.password = config.password;
}
}
var skinServer = new SkinServer(server);
- return skinServer.db(database, options);
+ return skinServer.db(database, dbOptions);
};
/**
View
2  lib/mongoskin/server.js
@@ -43,8 +43,6 @@ SkinServer.prototype.db = function (name, options) {
var skinDb = this._cache_[key];
if (!skinDb || skinDb.fail) {
var password = options.password;
- delete options.username;
- delete options.password;
if (!options.native_parser) {
options.native_parser = !! mongodb.BSONNative;
}
View
2  package.json
@@ -15,7 +15,7 @@
"node": ">= 0.4.0"
},
"dependencies": {
- "mongodb": ">= 0.9.8 < 1.1.0"
+ "mongodb": "< 1.2.0"
},
"devDependencies": {
"mocha": "*",
View
603 test/collection.js
@@ -16,338 +16,373 @@ var mongoskin = require('../');
var SkinCollection = mongoskin.SkinCollection;
var constant = require('../lib/mongoskin/constant');
var should = require('should');
+var servermanager = require('./utils/server_manager');
describe('collection.js', function () {
- var db;
+ var RS, RS_primary;
before(function (done) {
- db = mongoskin.db('localhost/mongoskin_test');
- db.bind('testcollection');
- db.testcollection.ensureIndex({title: -1});
- db.testcollection.findItems(function (err, rows) {
- if (err) {
- return done(err);
- }
- rows.should.be.instanceof(Array).with.length(0);
- done();
+ servermanager.ensureUp(function (err, rs, primary) {
+ RS = rs;
+ RS_primary = primary;
+ done(err);
});
});
- after(function (done) {
- db.testcollection.drop(function (err, result) {
- if (err) {
- return done(err);
- }
- should.ok(result);
- db.close(done);
- });
- });
-
- describe('open()', function () {
- var skinDb;
- beforeEach(function () {
- skinDb = {
- open: function (callback) {
- var that = this;
- process.nextTick(function () {
- callback(null, that.db);
- });
- },
- db: {
- name: 'mock db',
- collection: function (name, callback) {
- process.nextTick(function () {
- callback(null, {
- name: 'mock collection'
- });
- });
+
+ var cases = [
+ ['normal', {database: 'mongoskin_test'}],
+ ];
+ if (servermanager.MONGOSKIN_REPLICASET) {
+ cases.push(['replicaset', {database: 'mongoskin_replicaset_test'}]);
+ }
+ cases.forEach(function (caseItem) {
+ describe(caseItem[0], function () {
+ var isReplicaset = caseItem[0] === 'replicaset';
+ var db = null;
+ var servers = null;
+ var authfailServers = null;
+ var options = caseItem[1];
+ before(function (done) {
+ if (isReplicaset) {
+ servers = [];
+ authfailServers = [];
+ for (var i = 0; i < RS.ports.length; i++) {
+ servers.push(RS.host + ':' + RS.ports[i] + '/?auto_reconnect=true');
}
+ authfailServers = servers;
+ } else {
+ servers = RS_primary;
}
- };
- });
-
- it('should return a collection', function (done) {
- var collection = new SkinCollection(skinDb, 'foo');
- collection.hint = 123;
- collection.open(function (err, coll) {
- should.not.exist(err);
- coll.should.have.property('name', 'mock collection');
- collection.state.should.equal(constant.STATE_OPEN);
- done();
+ db = mongoskin.db(servers, options);
+ db.bind('testcollection');
+ db.testcollection.ensureIndex({title: -1});
+ db.testcollection.findItems(function (err, rows) {
+ if (err) {
+ return done(err);
+ }
+ rows.should.be.instanceof(Array).with.length(0);
+ done();
+ });
});
- });
- it('should return mock skinDb.open() error', function (done) {
- skinDb.open = function (callback) {
- process.nextTick(function () {
- callback(new Error('mock skinDb.open() error'));
+ after(function (done) {
+ db.testcollection.drop(function (err, result) {
+ if (err) {
+ return done(err);
+ }
+ should.ok(result);
+ db.close(done);
});
- };
- var collection = new SkinCollection(skinDb, 'foo');
- collection.open(function (err, coll) {
- should.exist(err);
- err.should.have.property('message', 'mock skinDb.open() error');
- should.not.exist(coll);
- collection.state.should.equal(constant.STATE_CLOSE);
- done();
});
- });
- it('should return mock db.collection() error', function (done) {
- skinDb.db.collection = function (name, callback) {
- process.nextTick(function () {
- callback(new Error('mock db.collection() error'));
+ describe('open()', function () {
+ var skinDb;
+ beforeEach(function () {
+ skinDb = {
+ open: function (callback) {
+ var that = this;
+ process.nextTick(function () {
+ callback(null, that.db);
+ });
+ },
+ db: {
+ name: 'mock db',
+ collection: function (name, callback) {
+ process.nextTick(function () {
+ callback(null, {
+ name: 'mock collection'
+ });
+ });
+ }
+ }
+ };
});
- };
- var collection = new SkinCollection(skinDb, 'foo');
- collection.open(function (err, coll) {
- should.exist(err);
- should.not.exist(coll);
- err.should.have.property('message', 'mock db.collection() error');
- collection.state.should.equal(constant.STATE_CLOSE);
- done();
- });
- });
- });
+ it('should return a collection', function (done) {
+ var collection = new SkinCollection(skinDb, 'foo');
+ collection.hint = 123;
+ collection.open(function (err, coll) {
+ should.not.exist(err);
+ coll.should.have.property('name', 'mock collection');
+ collection.state.should.equal(constant.STATE_OPEN);
+ done();
+ });
+ });
- describe('id()', function () {
- it('should convert string id to ObjectID success', function () {
- var id = '4ec4b2b9f44a927223000001';
- id = db.testcollection.id(id);
- id.should.be.instanceof(db.testcollection.ObjectID);
- id = db.testcollection.id(id);
- id.should.be.instanceof(db.testcollection.ObjectID);
- id = '4ec4b2b9f44a927223000foo';
- id = db.testcollection.id(id);
- id.should.be.instanceof(db.testcollection.ObjectID);
- });
- it('should return source id when id length !== 24', function () {
- var ids = [123, '4ec4b2b9f44a92722300000', 'abc', '4ec4b2b9f44a927223000f00123123'];
- ids.forEach(function (id) {
- db.testcollection.id(id).should.equal(id);
- });
- });
- });
+ it('should return mock skinDb.open() error', function (done) {
+ skinDb.open = function (callback) {
+ process.nextTick(function () {
+ callback(new Error('mock skinDb.open() error'));
+ });
+ };
+ var collection = new SkinCollection(skinDb, 'foo');
+ collection.open(function (err, coll) {
+ should.exist(err);
+ err.should.have.property('message', 'mock skinDb.open() error');
+ should.not.exist(coll);
+ collection.state.should.equal(constant.STATE_CLOSE);
+ done();
+ });
+ });
- describe('find(), findItems(), findEach()', function () {
- var objectIds = [], stringIds = [];
- before(function (done) {
- db.bind('comment');
- var inserts = [];
- for (var i = 0; i < 100; i++) {
- inserts.push({
- text: 'this is comment ' + i,
- createtime: new Date()
+ it('should return mock db.collection() error', function (done) {
+ skinDb.db.collection = function (name, callback) {
+ process.nextTick(function () {
+ callback(new Error('mock db.collection() error'));
+ });
+ };
+ var collection = new SkinCollection(skinDb, 'foo');
+ collection.open(function (err, coll) {
+ should.exist(err);
+ should.not.exist(coll);
+ err.should.have.property('message', 'mock db.collection() error');
+ collection.state.should.equal(constant.STATE_CLOSE);
+ done();
+ });
});
- }
- db.comment.insert(inserts, function (err, docs) {
- if (err) {
- return done(err);
- }
- for (var i = 0, l = docs.length; i < l; i++) {
- var doc = docs[i];
- stringIds.push(doc._id.toString());
- objectIds.push(doc._id);
- }
- done();
- });
- });
- after(function (done) {
- db.comment.drop(done);
- });
- it('should find().toArray() return 100 comments', function (done) {
- db.comment.find().toArray(function (err, rows) {
- should.not.exist(err);
- rows.should.be.instanceof(Array).with.length(100);
- done();
});
- });
- it('should findItems(fn) all comments', function (done) {
- db.comment.findItems(function (err, comments) {
- should.not.exist(err);
- should.exist(comments);
- comments.should.be.instanceof(Array).with.length(100);
- done();
+ describe('id()', function () {
+ it('should convert string id to ObjectID success', function () {
+ var id = '4ec4b2b9f44a927223000001';
+ id = db.testcollection.id(id);
+ id.should.be.instanceof(db.testcollection.ObjectID);
+ id = db.testcollection.id(id);
+ id.should.be.instanceof(db.testcollection.ObjectID);
+ id = '4ec4b2b9f44a927223000foo';
+ id = db.testcollection.id(id);
+ id.should.be.instanceof(db.testcollection.ObjectID);
+ });
+ it('should return source id when id length !== 24', function () {
+ var ids = [123, '4ec4b2b9f44a92722300000', 'abc', '4ec4b2b9f44a927223000f00123123'];
+ ids.forEach(function (id) {
+ db.testcollection.id(id).should.equal(id);
+ });
+ });
});
- });
- it('should findItems({} fn) all comments', function (done) {
- db.comment.findItems(function (err, comments) {
- should.not.exist(err);
- should.exist(comments);
- comments.should.be.instanceof(Array).with.length(100);
- done();
- });
- });
+ describe('find(), findItems(), findEach()', function () {
+ var objectIds = [], stringIds = [];
+ before(function (done) {
+ db.bind('comment');
+ var inserts = [];
+ for (var i = 0; i < 100; i++) {
+ inserts.push({
+ text: 'this is comment ' + i,
+ createtime: new Date()
+ });
+ }
+ db.comment.insert(inserts, function (err, docs) {
+ if (err) {
+ return done(err);
+ }
+ for (var i = 0, l = docs.length; i < l; i++) {
+ var doc = docs[i];
+ stringIds.push(doc._id.toString());
+ objectIds.push(doc._id);
+ }
+ done();
+ });
+ });
+ after(function (done) {
+ db.comment.drop(done);
+ });
- it('should findItems({limit: 10}) query wrong return top 0 comments', function (done) {
- db.comment.findItems({limit: 10}, function (err, comments) {
- should.not.exist(err);
- comments.should.be.instanceof(Array).with.length(0);
- done();
- });
- });
+ it('should find().toArray() return 100 comments', function (done) {
+ db.comment.find().toArray(function (err, rows) {
+ should.not.exist(err);
+ rows.should.be.instanceof(Array).with.length(100);
+ done();
+ });
+ });
- it('should findItems({}, {limit: 10}) return top 10 comments', function (done) {
- db.comment.findItems({}, {limit: 10}, function (err, comments) {
- should.not.exist(err);
- comments.should.be.instanceof(Array).with.length(10);
- done();
- });
- });
+ it('should findItems(fn) all comments', function (done) {
+ db.comment.findItems(function (err, comments) {
+ should.not.exist(err);
+ should.exist(comments);
+ comments.should.be.instanceof(Array).with.length(100);
+ done();
+ });
+ });
- it('should findEach(fn) call fn 100 times', function (done) {
- var count = 0;
- db.comment.findEach(function (err, comment) {
- should.not.exist(err);
- if (!comment) {
- count.should.equal(100);
- return done();
- }
- count++;
- });
- });
+ it('should findItems({} fn) all comments', function (done) {
+ db.comment.findItems(function (err, comments) {
+ should.not.exist(err);
+ should.exist(comments);
+ comments.should.be.instanceof(Array).with.length(100);
+ done();
+ });
+ });
- it('should findEach({}, {limit: 20}, fn) call fn 20 times', function (done) {
- var count = 0;
- db.comment.findEach({}, {limit: 20}, function (err, comment) {
- should.not.exist(err);
- if (!comment) {
- count.should.equal(20);
- return done();
- }
- count++;
- });
- });
+ it('should findItems({limit: 10}) query wrong return top 0 comments', function (done) {
+ db.comment.findItems({limit: 10}, function (err, comments) {
+ should.not.exist(err);
+ comments.should.be.instanceof(Array).with.length(0);
+ done();
+ });
+ });
- describe('mock find() error', function () {
- var _find;
- before(function () {
- _find = db.comment.find;
- db.comment.find = function () {
- var callback = arguments[arguments.length - 1];
- process.nextTick(function () {
- callback(new Error('mock find() error'));
+ it('should findItems({}, {limit: 10}) return top 10 comments', function (done) {
+ db.comment.findItems({}, {limit: 10}, function (err, comments) {
+ should.not.exist(err);
+ comments.should.be.instanceof(Array).with.length(10);
+ done();
});
- };
- });
- after(function () {
- if (_find) {
- db.comment.find = _find;
- }
- });
+ });
- it('should findItems() error', function (done) {
- db.comment.findItems(function (err, docs) {
- should.exist(err);
- err.should.be.instanceof(Error).with.have.property('message', 'mock find() error');
- should.not.exist(docs);
- done();
+ it('should findEach(fn) call fn 100 times', function (done) {
+ var count = 0;
+ db.comment.findEach(function (err, comment) {
+ should.not.exist(err);
+ if (!comment) {
+ count.should.equal(100);
+ return done();
+ }
+ count++;
+ });
});
- });
- it('should findEach() error', function (done) {
- db.comment.findEach(function (err, docs) {
- should.exist(err);
- err.should.be.instanceof(Error).with.have.property('message', 'mock find() error');
- should.not.exist(docs);
- done();
+
+ it('should findEach({}, {limit: 20}, fn) call fn 20 times', function (done) {
+ var count = 0;
+ db.comment.findEach({}, {limit: 20}, function (err, comment) {
+ should.not.exist(err);
+ if (!comment) {
+ count.should.equal(20);
+ return done();
+ }
+ count++;
+ });
});
- });
- });
- });
+ describe('mock find() error', function () {
+ var _find;
+ before(function () {
+ _find = db.comment.find;
+ db.comment.find = function () {
+ var callback = arguments[arguments.length - 1];
+ process.nextTick(function () {
+ callback(new Error('mock find() error'));
+ });
+ };
+ });
+ after(function () {
+ if (_find) {
+ db.comment.find = _find;
+ }
+ });
+
+ it('should findItems() error', function (done) {
+ db.comment.findItems(function (err, docs) {
+ should.exist(err);
+ err.should.be.instanceof(Error).with.have.property('message', 'mock find() error');
+ should.not.exist(docs);
+ done();
+ });
+ });
+ it('should findEach() error', function (done) {
+ db.comment.findEach(function (err, docs) {
+ should.exist(err);
+ err.should.be.instanceof(Error).with.have.property('message', 'mock find() error');
+ should.not.exist(docs);
+ done();
+ });
+ });
+ });
- describe('findById(), updateById(), removeById()', function () {
- var now = new Date();
- var articleId;
- before(function (done) {
- db.bind('article');
- db.article.insert({title: 'test article title ' + now, created_at: now}, function (err, article) {
- if (article) {
- articleId = article[0]._id;
- }
- done(err);
});
- });
- after(function (done) {
- db.article.drop(done);
- });
- describe('findById()', function () {
- it('should find one object by ObjectID', function (done) {
- db.article.findById(articleId, function (err, article) {
- should.not.exist(err);
- should.exist(article);
- article.should.have.property('_id').with.instanceof(db.ObjectID);
- article.should.have.property('created_at').with.instanceof(Date);
- article.should.have.property('title').with.include(now.toString());
- article.created_at.toString().should.equal(now.toString());
- done();
+ describe('findById(), updateById(), removeById()', function () {
+ var now = new Date();
+ var articleId;
+ before(function (done) {
+ db.bind('article');
+ db.article.insert({title: 'test article title ' + now, created_at: now}, function (err, article) {
+ if (article) {
+ articleId = article[0]._id;
+ }
+ done(err);
+ });
});
- });
- it('should find one object by String id', function (done) {
- db.article.findById(articleId.toString(), function (err, article) {
- should.not.exist(err);
- should.exist(article);
- article.should.have.property('_id').with.instanceof(db.ObjectID);
- article.should.have.property('created_at').with.instanceof(Date);
- article.should.have.property('title').with.include(now.toString());
- article.created_at.toString().should.equal(now.toString());
- done();
+ after(function (done) {
+ db.article.drop(done);
});
- });
- it('should not find when id not exists', function (done) {
- db.article.findById('foo', function (err, article) {
- should.not.exist(err);
- should.not.exist(article);
- done();
+
+ describe('findById()', function () {
+ it('should find one object by ObjectID', function (done) {
+ db.article.findById(articleId, function (err, article) {
+ should.not.exist(err);
+ should.exist(article);
+ article.should.have.property('_id').with.instanceof(db.ObjectID);
+ article.should.have.property('created_at').with.instanceof(Date);
+ article.should.have.property('title').with.include(now.toString());
+ article.created_at.toString().should.equal(now.toString());
+ done();
+ });
+ });
+ it('should find one object by String id', function (done) {
+ db.article.findById(articleId.toString(), function (err, article) {
+ should.not.exist(err);
+ should.exist(article);
+ article.should.have.property('_id').with.instanceof(db.ObjectID);
+ article.should.have.property('created_at').with.instanceof(Date);
+ article.should.have.property('title').with.include(now.toString());
+ article.created_at.toString().should.equal(now.toString());
+ done();
+ });
+ });
+ it('should not find when id not exists', function (done) {
+ db.article.findById('foo', function (err, article) {
+ should.not.exist(err);
+ should.not.exist(article);
+ done();
+ });
+ });
});
- });
- });
- describe('updateById()', function () {
- it('should update obj by id', function (done) {
- var updatedTime = new Date();
- var doc = {
- $set: {
- title: 'new title ' + updatedTime,
- updated_at: updatedTime
- }
- };
- db.article.updateById(articleId.toString(), doc, function (err, article) {
- should.not.exist(err);
- should.not.exist(article);
- db.article.findById(articleId, function (err, article) {
- should.not.exist(err);
- should.exist(article);
- article.should.have.property('title', 'new title ' + updatedTime);
- article.should.have.property('updated_at').with.instanceof(Date);
- article.updated_at.toString().should.equal(updatedTime.toString());
- done();
+ describe('updateById()', function () {
+ it('should update obj by id', function (done) {
+ var updatedTime = new Date();
+ var doc = {
+ $set: {
+ title: 'new title ' + updatedTime,
+ updated_at: updatedTime
+ }
+ };
+ db.article.updateById(articleId.toString(), doc, function (err, article) {
+ should.not.exist(err);
+ should.not.exist(article);
+ db.article.findById(articleId, function (err, article) {
+ should.not.exist(err);
+ should.exist(article);
+ article.should.have.property('title', 'new title ' + updatedTime);
+ article.should.have.property('updated_at').with.instanceof(Date);
+ article.updated_at.toString().should.equal(updatedTime.toString());
+ done();
+ });
+ });
});
});
- });
- });
- describe('removeById()', function () {
- it('should remove obj by id', function (done) {
- var id = articleId.toString();
- db.article.findById(id, function (err, article) {
- should.not.exist(err);
- should.exist(article);
- db.article.removeById(id, function (err, article) {
- should.not.exist(err);
- should.not.exist(article);
+ describe('removeById()', function () {
+ it('should remove obj by id', function (done) {
+ var id = articleId.toString();
db.article.findById(id, function (err, article) {
should.not.exist(err);
- should.not.exist(article);
- done();
+ should.exist(article);
+ db.article.removeById(id, function (err, article) {
+ should.not.exist(err);
+ should.not.exist(article);
+ db.article.findById(id, function (err, article) {
+ should.not.exist(err);
+ should.not.exist(article);
+ done();
+ });
+ });
});
});
});
+
});
});
-
});
});
View
290 test/cursor.js
@@ -16,151 +16,191 @@ var should = require('should');
var mongoskin = require('../');
var constant = require('../lib/mongoskin/constant');
var SkinCursor = mongoskin.SkinCursor;
+var servermanager = require('./utils/server_manager');
describe('cursor.js', function () {
- describe('new SkinCursor()', function () {
- it('should state is open when cursor exists', function () {
- var cursor = new SkinCursor({}, {});
- cursor.should.have.property('state', constant.STATE_OPEN);
- });
- it('should state is close when cursor not exists', function () {
- var cursor = new SkinCursor(null, {});
- cursor.should.have.property('state', constant.STATE_CLOSE);
+ var RS, RS_primary;
+ before(function (done) {
+ servermanager.ensureUp(function (err, rs, primary) {
+ RS = rs;
+ RS_primary = primary;
+ done(err);
});
});
+
+ var cases = [
+ ['normal', {database: 'mongoskin_test'}],
+ ];
+ if (servermanager.MONGOSKIN_REPLICASET) {
+ cases.push(['replicaset', {database: 'mongoskin_replicaset_test'}]);
+ }
+ cases.forEach(function (caseItem) {
+ describe(caseItem[0], function () {
+ var isReplicaset = caseItem[0] === 'replicaset';
+ var db = null;
+ var servers = null;
+ var authfailServers = null;
+ var options = caseItem[1];
+ before(function () {
+ if (isReplicaset) {
+ servers = [];
+ authfailServers = [];
+ for (var i = 0; i < RS.ports.length; i++) {
+ servers.push(RS.host + ':' + RS.ports[i] + '/?auto_reconnect=true');
+ }
+ authfailServers = servers;
+ } else {
+ servers = RS_primary;
+ }
+ db = mongoskin.db(servers, options);
+ });
+ after(function (done) {
+ db.close(done);
+ });
- describe('open()', function () {
- var collection;
- beforeEach(function () {
- collection = {
- open: function (callback) {
- var that = this;
- process.nextTick(function () {
- callback(null, that);
+ describe('new SkinCursor()', function () {
+ it('should state is open when cursor exists', function () {
+ var cursor = new SkinCursor({}, {});
+ cursor.should.have.property('state', constant.STATE_OPEN);
+ });
+ it('should state is close when cursor not exists', function () {
+ var cursor = new SkinCursor(null, {});
+ cursor.should.have.property('state', constant.STATE_CLOSE);
+ });
+ });
+
+ describe('open()', function () {
+ var collection;
+ beforeEach(function () {
+ collection = {
+ open: function (callback) {
+ var that = this;
+ process.nextTick(function () {
+ callback(null, that);
+ });
+ },
+ find: function () {
+ var callback = arguments[arguments.length - 1];
+ process.nextTick(function () {
+ callback(null, {name: 'mock cursor'});
+ });
+ }
+ };
+ });
+
+ it('should success when state is close', function (done) {
+ var cursor = new SkinCursor(null, collection);
+ cursor.open(function (err, mockCursor) {
+ should.not.exist(err);
+ mockCursor.should.have.property('name', 'mock cursor');
+ done();
});
- },
- find: function () {
- var callback = arguments[arguments.length - 1];
- process.nextTick(function () {
- callback(null, {name: 'mock cursor'});
+ });
+
+ it('should success when state is openning', function (done) {
+ var cursor = new SkinCursor(null, collection);
+ cursor.open(function (err, mockCursor) {
+ should.not.exist(err);
+ mockCursor.should.have.property('name', 'mock cursor');
});
- }
- };
- });
+ cursor.open(function (err, mockCursor) {
+ should.not.exist(err);
+ mockCursor.should.have.property('name', 'mock cursor');
+ done();
+ });
+ });
- it('should success when state is close', function (done) {
- var cursor = new SkinCursor(null, collection);
- cursor.open(function (err, mockCursor) {
- should.not.exist(err);
- mockCursor.should.have.property('name', 'mock cursor');
- done();
- });
- });
+ it('should success when state is open', function (done) {
+ var cursor = new SkinCursor({name: 'mock cursor 2'}, collection);
+ cursor.open(function (err, mockCursor) {
+ should.not.exist(err);
+ mockCursor.should.have.property('name', 'mock cursor 2');
+ done();
+ });
+ });
- it('should success when state is openning', function (done) {
- var cursor = new SkinCursor(null, collection);
- cursor.open(function (err, mockCursor) {
- should.not.exist(err);
- mockCursor.should.have.property('name', 'mock cursor');
- });
- cursor.open(function (err, mockCursor) {
- should.not.exist(err);
- mockCursor.should.have.property('name', 'mock cursor');
- done();
+ it('should return mock error', function (done) {
+ collection.open = function (callback) {
+ process.nextTick(function () {
+ callback(new Error('mock collection.open() error'));
+ });
+ };
+ var cursor = new SkinCursor(null, collection);
+ cursor.open(function (err, mockCursor) {
+ should.exist(err);
+ err.should.have.property('message', 'mock collection.open() error');
+ should.not.exist(mockCursor);
+ done();
+ });
+ });
});
- });
- it('should success when state is open', function (done) {
- var cursor = new SkinCursor({name: 'mock cursor 2'}, collection);
- cursor.open(function (err, mockCursor) {
- should.not.exist(err);
- mockCursor.should.have.property('name', 'mock cursor 2');
- done();
- });
- });
+ describe('sort(), limit(), skip(), toArray(), count(), explain()', function () {
- it('should return mock error', function (done) {
- collection.open = function (callback) {
- process.nextTick(function () {
- callback(new Error('mock collection.open() error'));
+ before(function (done) {
+ db.bind('testCursor');
+ var docs = [];
+ for (var i = 0; i < 100; i++) {
+ docs.push({name: 'name ' + i, index: i});
+ }
+ db.testCursor.insert(docs, function (err) {
+ done(err);
+ });
+ });
+ after(function (done) {
+ db.testCursor.drop(done);
});
- };
- var cursor = new SkinCursor(null, collection);
- cursor.open(function (err, mockCursor) {
- should.exist(err);
- err.should.have.property('message', 'mock collection.open() error');
- should.not.exist(mockCursor);
- done();
- });
- });
- });
- describe('sort(), limit(), skip(), toArray(), count(), explain()', function () {
- var db = mongoskin.db('localhost/mongoskin_test');
- db.bind('testCursor');
-
- before(function (done) {
- var docs = [];
- for (var i = 0; i < 100; i++) {
- docs.push({name: 'name ' + i, index: i});
- }
- db.testCursor.insert(docs, function (err) {
- done(err);
- });
- });
- after(function (done) {
- db.testCursor.drop(done);
- });
+ it('should cursor.skip(10).limit(10).toArray() return 10 rows', function (done) {
+ db.testCursor.find().skip(10).limit(10).toArray(function (err, rows) {
+ should.not.exist(err);
+ should.exist(rows);
+ rows.should.be.instanceof(Array).with.length(10);
+ rows[0].name.should.equal('name 10');
+ rows[9].name.should.equal('name 19');
+ done();
+ });
+ });
- it('should cursor.skip(10).limit(10).toArray() return 10 rows', function (done) {
- db.testCursor.find().skip(10).limit(10).toArray(function (err, rows) {
- should.not.exist(err);
- should.exist(rows);
- rows.should.be.instanceof(Array).with.length(10);
- rows[0].name.should.equal('name 10');
- rows[9].name.should.equal('name 19');
- done();
- });
- });
+ it('should cursor.sort({index: -1}).skip(20).limit(10).toArray() return 10 rows', function (done) {
+ db.testCursor.find().sort({index: -1}).skip(20).limit(10).toArray(function (err, rows) {
+ should.not.exist(err);
+ should.exist(rows);
+ rows.should.be.instanceof(Array).with.length(10);
+ rows[0].name.should.equal('name 79');
+ rows[9].name.should.equal('name 70');
+ done();
+ });
+ });
- it('should cursor.sort({index: -1}).skip(20).limit(10).toArray() return 10 rows', function (done) {
- db.testCursor.find().sort({index: -1}).skip(20).limit(10).toArray(function (err, rows) {
- should.not.exist(err);
- should.exist(rows);
- rows.should.be.instanceof(Array).with.length(10);
- rows[0].name.should.equal('name 79');
- rows[9].name.should.equal('name 70');
- done();
- });
- });
+ it('should cursor.count() return 100', function (done) {
+ db.testCursor.find().count(function (err, count) {
+ should.not.exist(err);
+ count.should.equal(100);
+ done();
+ });
+ });
- it('should cursor.count() return 100', function (done) {
- db.testCursor.find().count(function (err, count) {
- should.not.exist(err);
- count.should.equal(100);
- done();
- });
- });
+ it('should cursor.explain() return 100', function (done) {
+ db.testCursor.find({index: {$gt: 50}}).explain(function (err, result) {
+ should.not.exist(err);
+ result.should.eql({ cursor: 'BasicCursor',
+ nscanned: 100,
+ nscannedObjects: 100,
+ n: 49,
+ millis: 0,
+ nYields: 0,
+ nChunkSkips: 0,
+ isMultiKey: false,
+ indexOnly: false,
+ indexBounds: {},
+ allPlans: [ { cursor: 'BasicCursor', indexBounds: {} } ] });
+ done();
+ });
+ });
- it('should cursor.explain() return 100', function (done) {
- db.testCursor.find({index: {$gt: 50}}).explain(function (err, result) {
- should.not.exist(err);
- result.should.eql({ cursor: 'BasicCursor',
- nscanned: 100,
- nscannedObjects: 100,
- n: 49,
- millis: 0,
- nYields: 0,
- nChunkSkips: 0,
- isMultiKey: false,
- indexOnly: false,
- indexBounds: {},
- allPlans: [ { cursor: 'BasicCursor', indexBounds: {} } ] });
- done();
});
});
-
});
-
});
View
410 test/db.js
@@ -11,98 +11,133 @@
/**
* Module dependencies.
*/
-
+var should = require('should');
var mongoskin = require('../');
var pedding = require('./utils/pedding');
-var should = require('should');
var constant = require('../lib/mongoskin/constant');
+var servermanager = require('./utils/server_manager');
describe('db.js', function () {
- var db = mongoskin.db('localhost/mongoskin_test');
-
- after(function () {
- db.close();
+ var blackholePort = 24008;
+ var blackhole = require('net').createServer(function (c) {
+ // no reply, just for timeout
});
- describe('bind()', function () {
-
- after(function () {
- if (db.testCollection) {
- db.testCollection.drop();
- }
+ var RS, RS_primary;
+ before(function (done) {
+ done = pedding(2, done);
+ servermanager.ensureUp(function (err, rs, primary) {
+ RS = rs;
+ RS_primary = primary;
+ done(err);
});
+ blackhole.listen(blackholePort, done);
+ });
+
+ var cases = [
+ ['normal', {database: 'mongoskin_test'}],
+ ];
+ if (servermanager.MONGOSKIN_REPLICASET) {
+ cases.push(['replicaset', {database: 'mongoskin_replicaset_test'}]);
+ }
+ cases.forEach(function (caseItem) {
+ describe(caseItem[0], function () {
+ var isReplicaset = caseItem[0] === 'replicaset';
+ var db = null;
+ var servers = null;
+ var authfailServers = null;
+ var options = caseItem[1];
+ var authfailOptions = {};
+ for (var k in options) {
+ authfailOptions[k] = options[k];
+ }
+ before(function () {
+ if (isReplicaset) {
+ servers = [];
+ authfailServers = [];
+ for (var i = 0; i < RS.ports.length; i++) {
+ servers.push(RS.host + ':' + RS.ports[i] + '/?auto_reconnect=true');
+ }
+ authfailServers = servers;
+ authfailOptions.username = 'test';
+ authfailOptions.password = 'test';
+ } else {
+ servers = RS_primary;
+ authfailServers = 'test:test@' + servers;
+ }
+ db = mongoskin.db(servers, options);
+ });
- it('should throw error when collection name wrong', function () {
- var wrongNames = ['', null, 123, ' ', '\n \t ', undefined, 0, 1, new Date(), {}, []];
- wrongNames.forEach(function (name) {
- (function () {
- db.bind(name);
- }).should.throw('Must provide collection name to bind.');
+ after(function () {
+ db.close();
});
- });
- it('should throw error when options is not object', function () {
- (function () {
- db.bind('foo', function () {});
- }).should.throw('the args[1] should be object, but is `function () {}`');
- });
+ describe('bind()', function () {
- it('should add helper methods to collection', function (done) {
- db.bind('testCollection', {
- totalCount: function (calllback) {
- this.count(calllback);
- }
- });
- db.should.have.property('testCollection').with.have.property('totalCount').with.be.a('function');
- db.testCollection.totalCount(function (err, total) {
- should.not.exist(err);
- total.should.equal(0);
- done();
- });
- });
+ after(function () {
+ if (db.testCollection) {
+ db.testCollection.drop();
+ }
+ });
- });
+ it('should throw error when collection name wrong', function () {
+ var wrongNames = ['', null, 123, ' ', '\n \t ', undefined, 0, 1, new Date(), {}, []];
+ wrongNames.forEach(function (name) {
+ (function () {
+ db.bind(name);
+ }).should.throw('Must provide collection name to bind.');
+ });
+ });
- describe('gridfs()', function () {
- it('should start gridfs store', function () {
- db.gridfs();
- db.should.have.property('skinGridStore');
- });
- });
+ it('should throw error when options is not object', function () {
+ (function () {
+ db.bind('foo', function () {});
+ }).should.throw('the args[1] should be object, but is `function () {}`');
+ });
+
+ it('should add helper methods to collection', function (done) {
+ db.bind('testCollection', {
+ totalCount: function (calllback) {
+ this.count(calllback);
+ }
+ });
+ db.should.have.property('testCollection').with.have.property('totalCount').with.be.a('function');
+ db.testCollection.totalCount(function (err, total) {
+ should.not.exist(err);
+ total.should.equal(0);
+ done();
+ });
+ });
- describe('open()', function () {
-
- it('should open a database connection', function (done) {
- var db1 = mongoskin.db('localhost/mongoskin_test');
- db1.state.should.equal(0);
- db1.open(function (err) {
- should.not.exist(err);
- db1.state.should.equal(2);
- }).open(function (err) {
- should.not.exist(err);
- db1.state.should.equal(2);
- done();
});
- db1.state.should.equal(1);
- });
- it('should open a database connection with user auth fail', function (done) {
- var db2 = mongoskin.db('test:test@localhost/mongoskin_test');
- done = pedding(2, done);
- db2.state.should.equal(constant.STATE_CLOSE);
- db2.open(function (err, db) {
- should.exist(err);
- err.should.have.property('message', 'auth fails');
- err.should.have.property('name', 'MongoError');
- should.not.exist(db);
- db2.state.should.equal(constant.STATE_CLOSE);
- // open again
- db2.open(function (err, db) {
- should.exist(err);
- err.should.have.property('message', 'auth fails');
- err.should.have.property('name', 'MongoError');
- should.not.exist(db);
+ describe('gridfs()', function () {
+ it('should start gridfs store', function () {
+ db.gridfs();
+ db.should.have.property('skinGridStore');
+ });
+ });
+
+ describe('open()', function () {
+
+ it('should open a database connection', function (done) {
+ var db1 = mongoskin.db(servers, options);
+ db1.state.should.equal(0);
+ db1.open(function (err) {
+ should.not.exist(err);
+ db1.state.should.equal(2);
+ }).open(function (err) {
+ should.not.exist(err);
+ db1.state.should.equal(2);
+ done();
+ });
+ db1.state.should.equal(1);
+ });
+
+ it('should open a database connection with user auth fail', function (done) {
+ var db2 = mongoskin.db(authfailServers, authfailOptions);
+ done = pedding(2, done);
db2.state.should.equal(constant.STATE_CLOSE);
db2.open(function (err, db) {
should.exist(err);
@@ -110,116 +145,157 @@ describe('db.js', function () {
err.should.have.property('name', 'MongoError');
should.not.exist(db);
db2.state.should.equal(constant.STATE_CLOSE);
+ // open again
+ db2.open(function (err, db) {
+ should.exist(err);
+ err.should.have.property('message', 'auth fails');
+ err.should.have.property('name', 'MongoError');
+ should.not.exist(db);
+ db2.state.should.equal(constant.STATE_CLOSE);
+ db2.open(function (err, db) {
+ should.exist(err);
+ err.should.have.property('message', 'auth fails');
+ err.should.have.property('name', 'MongoError');
+ should.not.exist(db);
+ db2.state.should.equal(constant.STATE_CLOSE);
+ done();
+ });
+ });
+ });
+ db2.state.should.equal(constant.STATE_OPENNING);
+ db2.open(function (err, db) {
+ should.exist(err);
+ err.should.have.property('message', 'auth fails');
+ err.should.have.property('name', 'MongoError');
+ should.not.exist(db);
done();
});
});
- });
- db2.state.should.equal(constant.STATE_OPENNING);
- db2.open(function (err, db) {
- should.exist(err);
- err.should.have.property('message', 'auth fails');
- err.should.have.property('name', 'MongoError');
- should.not.exist(db);
- done();
- });
- });
- it('should open 100 times ok', function (done) {
- var db3 = mongoskin.db('localhost/mongoskin_test');
- done = pedding(100, done);
- for (var i = 0; i < 100; i++) {
- db3.open(function (err, db) {
- should.not.exist(err);
- should.exist(db);
- done();
+ it('should open 100 times ok', function (done) {
+ var db3 = mongoskin.db(servers, options);
+ done = pedding(100, done);
+ for (var i = 0; i < 100; i++) {
+ db3.open(function (err, db) {
+ should.not.exist(err);
+ should.exist(db);
+ done();
+ });
+ }
});
- }
- });
-
- });
- describe('close()', function () {
- it('should close a database connection', function (done) {
- var dbClose = mongoskin.db('localhost/mongoskin_test');
- dbClose.state.should.equal(0);
- dbClose.close(function (err) {
- dbClose.state.should.equal(0);
- should.not.exist(err);
- }).open(function (err) {
- dbClose.state.should.equal(2);
- should.not.exist(err);
- }).close(function (err) {
- dbClose.state.should.equal(0);
- should.not.exist(err);
- done();
+ it('should open timeout when connect the blackhole', function (done) {
+ var db;
+ if (isReplicaset) {
+ db = mongoskin.db(['127.0.0.1:' + blackholePort, '127.0.0.1:' + blackholePort],
+ options, {socketOptions: {timeout: 500}});
+ } else {
+ var ops = {};
+ for (var k in options) {
+ ops[k] = options[k];
+ }
+ ops.socketOptions = {timeout: 500};
+ db = mongoskin.db('127.0.0.1:' + blackholePort, ops);
+ }
+ db.open(function (err, db) {
+ should.exist(err);
+ if (isReplicaset) {
+ // replicaset should not timeout error
+ err.should.have.property('message', 'no primary server found in set');
+ } else {
+ err.should.have.property('err', 'connection to [127.0.0.1:24008] timed out');
+ }
+ should.not.exist(db);
+ done();
+ });
+ });
+
});
- dbClose.state.should.equal(1);
- });
- it('should close 100 times ok', function (done) {
- var db3 = mongoskin.db('localhost/mongoskin_test');
- done = pedding(100, done);
- db.open();
- for (var i = 0; i < 100; i++) {
- db3.close(function (err) {
- should.not.exist(err);
- done();
+ describe('close()', function () {
+ it('should close a database connection', function (done) {
+ var dbClose = mongoskin.db(servers, options);
+ dbClose.state.should.equal(0);
+ dbClose.close(function (err) {
+ dbClose.state.should.equal(0);
+ should.not.exist(err);
+ }).open(function (err) {
+ dbClose.state.should.equal(2);
+ should.not.exist(err);
+ }).close(function (err) {
+ dbClose.state.should.equal(0);
+ should.not.exist(err);
+ done();
+ });
+ dbClose.state.should.equal(1);
});
- }
- });
- });
-
- describe('ensureIndex()', function () {
- it('should index infos is empty', function (done) {
- var barDb = mongoskin.db('localhost/mongoskin_test');
- barDb.indexInformation('not-exists', function (err, result) {
- should.not.exist(err);
- should.exist(result);
- result.should.eql({});
- done();
+ it('should close 100 times ok', function (done) {
+ var db3 = mongoskin.db(servers, options);
+ done = pedding(100, done);
+ db.open();
+ for (var i = 0; i < 100; i++) {
+ db3.close(function (err) {
+ should.not.exist(err);
+ done();
+ });
+ }
+ });
});
- });
- it('should get index infos error', function (done) {
- var barDb = mongoskin.db('test:test@localhost/mongoskin_test');
- barDb.indexInformation('not-exists', function (err, result) {
- should.exist(err);
- should.not.exist(result);
- done();
- });
- });
+ describe('ensureIndex()', function () {
- it('should create title:1 index success', function (done) {
- db.ensureIndex('foo', {title: 1}, function (err, result) {
- should.not.exist(err);
- should.exist(result);
- result.should.equal('title_1');
- done();
- });
- });
+ it('should index infos is empty', function (done) {
+ var barDb = mongoskin.db(servers, options);
+ barDb.indexInformation('not-exists', function (err, result) {
+ should.not.exist(err);
+ should.exist(result);
+ result.should.eql({});
+ done();
+ });
+ });
- it('should create title:-1 index success', function (done) {
- db.ensureIndex('foo', {title: -1}, function (err, result) {
- should.not.exist(err);
- should.exist(result);
- result.should.equal('title_-1');
- done();
- });
- });
+ it('should get index infos error', function (done) {
+ var barDb = mongoskin.db(authfailServers, authfailOptions);
+ barDb.indexInformation('not-exists', function (err, result) {
+ should.exist(err);
+ should.not.exist(result);
+ done();
+ });
+ });
+
+ it('should create title:1 index success', function (done) {
+ db.ensureIndex('foo', {title: 1}, function (err, result) {
+ should.not.exist(err);
+ should.exist(result);
+ result.should.equal('title_1');
+ done();
+ });
+ });
- it('should get all index infos', function (done) {
- db.indexInformation('foo', function (err, result) {
- should.not.exist(err);
- should.exist(result);
- result.should.eql({
- _id_: [ [ '_id', 1 ] ],
- title_1: [ [ 'title', 1 ] ],
- 'title_-1': [ [ 'title', -1 ] ]
+ it('should create title:-1 index success', function (done) {
+ db.ensureIndex('foo', {title: -1}, function (err, result) {
+ should.not.exist(err);
+ should.exist(result);
+ result.should.equal('title_-1');
+ done();
+ });
+ });
+
+ it('should get all index infos', function (done) {
+ db.indexInformation('foo', function (err, result) {
+ should.not.exist(err);
+ should.exist(result);
+ result.should.eql({
+ _id_: [ [ '_id', 1 ] ],
+ title_1: [ [ 'title', 1 ] ],
+ 'title_-1': [ [ 'title', -1 ] ]
+ });
+ done();
+ });
});
- done();
});
+
});
});
-
});
View
1  test/tools/keyfile.txt
@@ -0,0 +1 @@
+THIS IS A SECRET KEYFILE FOR REPLICA SETS BWAHAHAHAH
View
56 test/utils/server_manager.js
@@ -0,0 +1,56 @@
+/*!
+ * mongoskin - test/utils/server_manager.js
+ * Copyright(c) 2012 fengmk2 <fengmk2@gmail.com>
+ * MIT Licensed
+ */
+
+"use strict";
+
+/**
+ * Module dependencies.
+ */
+
+var MONGOSKIN_REPLICASET = process.env.MONGOSKIN_REPLICASET === 'true';
+var ReplicaSetManager = require('../../deps/mongodb/test/tools/replica_set_manager').ReplicaSetManager;
+var ServerManager = require('../../deps/mongodb/test/tools/server_manager').ServerManager;
+
+var RS = null;
+var RS_primary = null;
+
+exports.ensureUp = function (callback) {
+ // Create instance of replicaset manager but only for the first call
+ if (!RS) {
+ if (!MONGOSKIN_REPLICASET) {
+ RS = new ServerManager();
+ RS.start(true, {purgedirectories: true}, function (err) {
+ RS_primary = '127.0.0.1:' + RS.port;
+ callback(err, RS, RS_primary);
+ });
+ } else {
+ RS = new ReplicaSetManager({retries: 120, secondary_count: 1, passive_count: 0, arbiter_count: 1});
+ RS.startSet(true, function (err, result) {
+ RS.primary(function (err, primary) {
+ RS_primary = primary;
+ callback(err, RS, RS_primary);
+ });
+ });
+ }
+ process.on('exit', function () {
+ console.log('process exit, stop mongod...');
+ RS.killAll(function () {});
+ });
+ } else {
+ callback(null, RS, RS_primary);
+ }
+};
+
+exports.ensureDown = function (callback) {
+ callback();
+ // if (RS) {
+ // RS.killAll(callback);
+ // } else {
+ // callback();
+ // }
+};
+
+exports.MONGOSKIN_REPLICASET = MONGOSKIN_REPLICASET;
Please sign in to comment.
Something went wrong with that request. Please try again.