Skip to content

Commit 2d03827

Browse files
committed
Minor fix to handle 2.4.x errors better by correctly return driver layer issues.
1 parent a906383 commit 2d03827

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/db.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,11 @@ Db.prototype.addChild = function(db) {
970970
}
971971

972972
/**
973-
* Create a new Db instance sharing the current socket connections.
973+
* Create a new Db instance sharing the current socket connections. Be aware that the new db instances are
974+
* related in a parent-child relationship to the original instance so that events are correctly emitted on child
975+
* db instances. Child db instances are cached so performing db('db1') twice will return the same instance.
976+
* You can control these behaviors with the options noListener and returnNonCachedInstance.
977+
*
974978
* @method
975979
* @param {string} name The name of the database we want to use.
976980
* @param {object} [options=null] Optional settings.

test/functional/index_tests.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ exports.shouldCorrectlyCreateAndUseSparseIndex = {
354354
exports.shouldCorrectlyHandleGeospatialIndexes = {
355355
// Add a tag that our runner can trigger on
356356
// in this case we are setting that node needs to be higher than 0.10.X to run
357-
metadata: { requires: { mongodb: ">1.9.1", topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
357+
metadata: { requires: { mongodb: ">2.6.0", topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
358358

359359
// The actual test we wish to run
360360
test: function(configuration, test) {
@@ -367,8 +367,8 @@ exports.shouldCorrectlyHandleGeospatialIndexes = {
367367
test.equal(err,null);
368368

369369
collection.insert({'loc': [200,200]}, configuration.writeConcernMax(), function(err, result) {
370-
err = err ? err : {};
371-
370+
console.dir(err)
371+
console.dir(result)
372372
test.ok(err.errmsg.indexOf("point not in interval of") != -1);
373373
test.ok(err.errmsg.indexOf("-180") != -1);
374374
test.ok(err.errmsg.indexOf("180") != -1);
@@ -389,7 +389,7 @@ exports.shouldCorrectlyHandleGeospatialIndexes = {
389389
exports.shouldCorrectlyHandleGeospatialIndexesAlteredRange = {
390390
// Add a tag that our runner can trigger on
391391
// in this case we are setting that node needs to be higher than 0.10.X to run
392-
metadata: { requires: { mongodb: ">1.9.1", topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
392+
metadata: { requires: { mongodb: ">2.6.0", topology: ['single', 'replicaset', 'sharded', 'ssl', 'heap', 'wiredtiger'] } },
393393

394394
// The actual test we wish to run
395395
test: function(configuration, test) {
@@ -403,7 +403,6 @@ exports.shouldCorrectlyHandleGeospatialIndexesAlteredRange = {
403403
collection.insert({'loc': [200,200]}, configuration.writeConcernMax(), function(err, result) {
404404
test.equal(err,null);
405405
collection.insert({'loc': [-200,-200]}, configuration.writeConcernMax(), function(err, result) {
406-
err = err ? err : {};
407406
test.ok(err.errmsg.indexOf("point not in interval of") != -1);
408407
test.ok(err.errmsg.indexOf("0") != -1);
409408
test.ok(err.errmsg.indexOf("1024") != -1);

0 commit comments

Comments
 (0)