|
|
@ -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)); |
|
|
|