Permalink
Browse files

don't return cursor for collection functions that don't return a cursor

  • Loading branch information...
1 parent f46d22a commit 6216cbb2cbe52b6561d57b66207cbbd348072725 @vpulim committed Nov 2, 2011
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/collection.js
  2. +1 −1 package.json
View
@@ -69,12 +69,13 @@ Collection.functions.forEach(function(name) {
Collection.prototype[name] = function() {
var self = this,
args = Array.prototype.slice.call(arguments),
+ isCursorOp = ~Collection.cursorFunctions.indexOf(name),
cursor = new Cursor(name, args);
self._waiting.push(cursor);
if (self._isConnected) {
- if (~Collection.cursorFunctions.indexOf(name)) {
+ if (isCursorOp) {
process.nextTick(function() {
self._connected(self._collection);
})
@@ -84,7 +85,7 @@ Collection.functions.forEach(function(name) {
}
}
- return cursor;
+ return isCursorOp ? cursor : null;
}
})
View
@@ -1,6 +1,6 @@
{
"name":"mongode",
- "version":"0.0.8",
+ "version":"0.0.9",
"description":"A thin wrapper around node-mongodb-native with a simpler API",
"engines":{"node":">=0.4.0"},
"author":"Vinay Pulim <v@pulim.com>",

0 comments on commit 6216cbb

Please sign in to comment.