Browse Source

Fix the code styling and add error handling.

saintedlama/travis-non-legacy
Eduardo Sorribas 12 years ago
parent
commit
fd3b42f943
  1. 7
      index.js

7
index.js

@ -148,11 +148,12 @@ Collection.prototype.group = function(group, callback) {
};
Collection.prototype.remove = function() {
var thiz = this;
var self = this;
if (arguments[1] == true) { // the justOne parameter
var args = arguments;
this.find(arguments[0], function(err, docs) {
thiz._apply(DRIVER_COLLECTION_PROTO.remove,[docs[0], getCallback(args)]);
this.findOne(arguments[0], function(err, doc) {
if (err) return getCallback(args)(err);
self._apply(DRIVER_COLLECTION_PROTO.remove,[doc, getCallback(args)]);
});
} else {
this._apply(DRIVER_COLLECTION_PROTO.remove, arguments.length === 0 ? [{}, noop] : ensureCallback(arguments));

Loading…
Cancel
Save