Skip to content

Commit 5e9f30c

Browse files
committed
Changed misleading parameter name
1 parent 6616031 commit 5e9f30c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/collection.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ define.classMethod('updateOne', {callback: true, promise:true});
916916
* @param {Collection~updateWriteOpCallback} [callback] The command result callback
917917
* @return {Promise} returns Promise if no callback passed
918918
*/
919-
Collection.prototype.replaceOne = function(filter, update, options, callback) {
919+
Collection.prototype.replaceOne = function(filter, doc, options, callback) {
920920
var self = this;
921921
if(typeof options == 'function') callback = options, options = {};
922922
options = shallowClone(options)
@@ -928,30 +928,30 @@ Collection.prototype.replaceOne = function(filter, update, options, callback) {
928928
}
929929

930930
// Execute using callback
931-
if(typeof callback == 'function') return replaceOne(self, filter, update, options, callback);
931+
if(typeof callback == 'function') return replaceOne(self, filter, doc, options, callback);
932932

933933
// Return a Promise
934934
return new this.s.promiseLibrary(function(resolve, reject) {
935-
replaceOne(self, filter, update, options, function(err, r) {
935+
replaceOne(self, filter, doc, options, function(err, r) {
936936
if(err) return reject(err);
937937
resolve(r);
938938
});
939939
});
940940
}
941941

942-
var replaceOne = function(self, filter, update, options, callback) {
942+
var replaceOne = function(self, filter, doc, options, callback) {
943943
// Set single document update
944944
options.multi = false;
945945
// Execute update
946-
updateDocuments(self, filter, update, options, function(err, r) {
946+
updateDocuments(self, filter, doc, options, function(err, r) {
947947
if(callback == null) return;
948948
if(err && callback) return callback(err);
949949
if(r == null) return callback(null, {result: {ok:1}});
950950
r.matchedCount = r.result.n;
951951
r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n;
952952
r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null;
953953
r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0;
954-
r.ops = [update];
954+
r.ops = [doc];
955955
if(callback) callback(null, r);
956956
});
957957
}

0 commit comments

Comments
 (0)