Skip to content

Commit 6b3241f

Browse files
committed
fix(model): avoid throwing unnecessary error if updateOne() returns null in save()
1 parent efae3ba commit 6b3241f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/model.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ Model.prototype.$__handleSave = function(options, callback) {
387387

388388
this[modelCollectionSymbol].updateOne(where, update, saveOptions).then(
389389
ret => {
390-
ret.$where = where;
390+
if (ret == null) {
391+
ret = { $where: where };
392+
} else {
393+
ret.$where = where;
394+
}
391395
callback(null, ret);
392396
},
393397
err => {

0 commit comments

Comments
 (0)