Skip to content

Commit

Permalink
Updated history and added test for iterating with each over no documents
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Sep 10, 2012
1 parent 071dbeb commit 214dde0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions HISTORY
Expand Up @@ -5,6 +5,7 @@
- Made PingStrategy api more consistant, callback to start/stop methods are optional (Issue #693, https://github.com/aheckmann)
- Proper stopping of strategy on replicaset stop
- Throw error when gridstore file is not found in read mode (Issue #702, https://github.com/jbrumwell)
- Cursor stream resume now using nextTick to avoid duplicated records (Issue #696)

1.1.6 2012-09-01
----------------
Expand Down
20 changes: 20 additions & 0 deletions test/find_test.js
Expand Up @@ -1797,6 +1797,26 @@ exports['Readpreferences should work fine when using a single server instance']
});
}

exports['Each should not hang on iterating over no results'] = function(test) {
var server = new Server("127.0.0.1", 27017, {auto_reconnect: false, poolSize: 4, ssl:useSSL, readPreference:ReadPreference.PRIMARY_PREFERRED});
var db = new Db('not_existing', server, {native_parser: native_parser, readPreference:ReadPreference.PRIMARY_PREFERRED});

// Establish connection to db
db.open(function(err, db) {
test.equal(null, err);
// Create a collection we want to drop later
db.collection('noresultAvailableForEachToIterate', function(err, collection) {
// Peform a simple find and return all the documents
collection.find({}).each(function(err, item) {
test.equal(null, item);

db.close();
test.done();
});
});
});
}

/**
* Retrieve the server information for the current
* instance of the db client
Expand Down

0 comments on commit 214dde0

Please sign in to comment.