Skip to content

Commit 2b80f02

Browse files
author
David Bengsch
authored
Merge pull request #199 from kuzzleio/add-retryOnConflict-support
Add support for the new retryOnConflict option
2 parents 24a8bc4 + 37a06c2 commit 2b80f02

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Collection.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,10 @@ Collection.prototype.updateDocument = function (documentId, content, options, cb
634634
options = null;
635635
}
636636

637+
if (options && options.retryOnConflict) {
638+
data.retryOnConflict = options.retryOnConflict;
639+
}
640+
637641
data = self.kuzzle.addHeaders(data, this.headers);
638642

639643
self.kuzzle.query(this.buildQueryArgs('document', 'update'), data, options, cb && function (err, res) {

test/Collection/methods.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,9 @@ describe('Collection methods', function () {
965965
it('should send the right updateDocument query to Kuzzle', function (done) {
966966
var
967967
collection = new Collection(kuzzle, expectedQuery.collection, expectedQuery.index),
968-
options = { queuable: false };
968+
options = { queuable: false, retryOnConflict: 42 };
969969
expectedQuery.options = options;
970+
expectedQuery.retryOnConflict = 42;
970971

971972
should(collection.updateDocument(result.result._id, result.result._source, options, function (err, res) {
972973
should(err).be.null();

0 commit comments

Comments
 (0)