From 987d9e018f581e1a605d5b3df66ec82465a48a79 Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 19 Mar 2024 14:55:04 +0100 Subject: [PATCH] Implement versionAttribute Fixes DE-783. --- CHANGELOG.md | 7 +++++++ src/collection.ts | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cde13b92..761dda55b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ This driver uses semantic versioning: - A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_ changes that require changes in your code to upgrade. +## [Unreleased] + +### Added + +- Added the `versionAttribute` option to the document operation options types (DE-783) + ## [8.8.0] ### Changed @@ -1788,6 +1794,7 @@ For a detailed list of changes between pre-release versions of v7 see the Graph methods now only return the relevant part of the response body. +[unreleased]: https://github.com/arangodb/arangojs/compare/v8.8.0...HEAD [8.8.0]: https://github.com/arangodb/arangojs/compare/v8.7.0...v8.8.0 [8.7.0]: https://github.com/arangodb/arangojs/compare/v8.6.0...v8.7.0 [8.6.0]: https://github.com/arangodb/arangojs/compare/v8.5.0...v8.6.0 diff --git a/src/collection.ts b/src/collection.ts index 5da7a1678..f0419cd50 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -743,6 +743,13 @@ export type CollectionInsertOptions = { * Default: `false` */ refillIndexCaches?: boolean; + /** + * If set, the attribute with the name specified by the option is looked up + * in the stored document and the attribute value is compared numerically to + * the value of the versioning attribute in the supplied document that is + * supposed to update/replace it. + */ + versionAttribute?: string; }; /** @@ -796,6 +803,13 @@ export type CollectionReplaceOptions = { * Default: `false` */ refillIndexCaches?: boolean; + /** + * If set, the attribute with the name specified by the option is looked up + * in the stored document and the attribute value is compared numerically to + * the value of the versioning attribute in the supplied document that is + * supposed to update/replace it. + */ + versionAttribute?: string; }; /** @@ -864,6 +878,13 @@ export type CollectionUpdateOptions = { * Default: `false` */ refillIndexCaches?: boolean; + /** + * If set, the attribute with the name specified by the option is looked up + * in the stored document and the attribute value is compared numerically to + * the value of the versioning attribute in the supplied document that is + * supposed to update/replace it. + */ + versionAttribute?: string; }; /**