Browse files

Fix pending requests.

  • Loading branch information...
1 parent fb6afe4 commit b1dc662b56d20dd76cfcee81826bbc2c8aef1a1a Sam Rijs committed Apr 6, 2013
Showing with 6 additions and 3 deletions.
  1. +6 −3 index.js
View
9 index.js
@@ -40,8 +40,11 @@ exports.open = function(a, b, c) {
collectionWrapper.connection = collection;
pendingRequests = collectionWrapper.pendingRequests;
COLLECTION[collection.collectionName] = collection;
- for (i = 0; request = pendingRequests[i]; i++)
- collection[request.method].apply(collection, request.arguments);
+ if (pendingRequests) {
+ pendingRequests.forEach(function (request) {
+ collection[request.method].apply(collection, request.arguments);
+ });
+ }
}
}
@@ -150,4 +153,4 @@ mongo.Collection.prototype.findAll = function() {
}
//==============================================================================
-init();
+init();

0 comments on commit b1dc662

Please sign in to comment.