Permalink
Browse files

doc#remove now passes safe options

how has this gone unnoticed?
  • Loading branch information...
1 parent 214ecbe commit d93234303d7b28bcbc59293dc0d026ebc8b72478 @aheckmann aheckmann committed Jun 5, 2012
Showing with 11 additions and 4 deletions.
  1. +11 −4 lib/model.js
View
@@ -482,15 +482,22 @@ Model.prototype.remove = function remove (fn) {
var promise = this._removing = new Promise(fn)
, where = this._where()
- , self = this;
+ , self = this
+ , options = {}
+
+ if (this.options.safe) {
+ options.safe = this.options.safe;
+ }
- this.collection.remove(where, tick(function (err) {
+ this.collection.remove(where, options, tick(function (err) {
if (err) {
- this._removing = null;
- return promise.error(err);
+ promise.error(err);
+ promise = self = self._removing = where = options = null;
+ return;
}
promise.complete();
self.emit('remove', self);
+ promise = self = where = options = null;
}));
return this;

0 comments on commit d932343

Please sign in to comment.