mirror of https://gitee.com/bigwinds/arangodb
parent
3a0ed2f8b9
commit
413a81fba9
14
CHANGELOG
14
CHANGELOG
|
@ -1,6 +1,20 @@
|
||||||
v3.5.3 (XXXX-XX-XX)
|
v3.5.3 (XXXX-XX-XX)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
* Fixed UPSERT matching.
|
||||||
|
|
||||||
|
Empty objects in the `UPSERT { ... }` expression will not be omitted anymore:
|
||||||
|
|
||||||
|
db._collection("col").insert({ "find" : "me" });
|
||||||
|
db._query(` UPSERT { "find" : "me", "foo" : {} }
|
||||||
|
UPDATE { "foo" : "not gonna happen" }
|
||||||
|
INSERT { "find" : "me", "foo" : {} }
|
||||||
|
INTO col
|
||||||
|
`)
|
||||||
|
|
||||||
|
This will now correctly insert a document instead of updating the existing,
|
||||||
|
that only partially machtes the upsert-expression.
|
||||||
|
|
||||||
* Fixed undefined behaviour with creation of ArangoSearch links with custom
|
* Fixed undefined behaviour with creation of ArangoSearch links with custom
|
||||||
analyzers in cluster environment.
|
analyzers in cluster environment.
|
||||||
|
|
||||||
|
|
|
@ -2665,7 +2665,6 @@ AstNode* Ast::makeConditionFromExample(AstNode const* node) {
|
||||||
TRI_ASSERT(object->type == NODE_TYPE_OBJECT);
|
TRI_ASSERT(object->type == NODE_TYPE_OBJECT);
|
||||||
|
|
||||||
auto const n = object->numMembers();
|
auto const n = object->numMembers();
|
||||||
|
|
||||||
for (size_t i = 0; i < n; ++i) {
|
for (size_t i = 0; i < n; ++i) {
|
||||||
auto member = object->getMember(i);
|
auto member = object->getMember(i);
|
||||||
|
|
||||||
|
@ -2680,7 +2679,7 @@ AstNode* Ast::makeConditionFromExample(AstNode const* node) {
|
||||||
|
|
||||||
auto value = member->getMember(0);
|
auto value = member->getMember(0);
|
||||||
|
|
||||||
if (value->type == NODE_TYPE_OBJECT) {
|
if (value->type == NODE_TYPE_OBJECT && value->numMembers() != 0) {
|
||||||
createCondition(value);
|
createCondition(value);
|
||||||
} else {
|
} else {
|
||||||
auto access = variable;
|
auto access = variable;
|
||||||
|
|
|
@ -1127,6 +1127,39 @@ function aqlUpsertOptionsSuite() {
|
||||||
validateDocsAreUpdated(docs, invalid, true);
|
validateDocsAreUpdated(docs, invalid, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testUpsertEmptyObject: function () {
|
||||||
|
let NEW, OLD, res;
|
||||||
|
col.insert({ "value1": "find me" });
|
||||||
|
|
||||||
|
// before "find me" was found because the empty object
|
||||||
|
// was ignored now we will insert instead
|
||||||
|
let q1 = `UPSERT { "value1" : "find me", "value2" : {} }
|
||||||
|
INSERT { "value1" : "find me", "value2" : {} }
|
||||||
|
UPDATE { "value1" : "not gonna happen" }
|
||||||
|
IN ${collectionName}
|
||||||
|
RETURN [$OLD, $NEW]`;
|
||||||
|
|
||||||
|
res = db._query(q1).toArray();
|
||||||
|
OLD = res[0][0];
|
||||||
|
NEW = res[0][1];
|
||||||
|
assertEqual(NEW.value1, "find me");
|
||||||
|
assertEqual(NEW.value2, {});
|
||||||
|
|
||||||
|
|
||||||
|
// now we update the exact doucment
|
||||||
|
let q2 = `UPSERT { "value1" : "find me", "value2" : {} }
|
||||||
|
INSERT { "value1" : "not gonna happen" }
|
||||||
|
UPDATE { "value1" : "update" }
|
||||||
|
IN ${collectionName}
|
||||||
|
RETURN [$OLD, $NEW]`;
|
||||||
|
|
||||||
|
res = db._query(q2).toArray();
|
||||||
|
OLD = res[0][0];
|
||||||
|
NEW = res[0][1];
|
||||||
|
assertEqual(NEW.value1, "update");
|
||||||
|
assertEqual(NEW.value2, {});
|
||||||
|
},
|
||||||
|
|
||||||
/* We cannot yet solve this. If you need to ensure _rev value checks put them in the UPDATE {} clause
|
/* We cannot yet solve this. If you need to ensure _rev value checks put them in the UPDATE {} clause
|
||||||
testUpsertSingleWithInvalidRevInMatch : function () {
|
testUpsertSingleWithInvalidRevInMatch : function () {
|
||||||
const invalid = genInvalidValue();
|
const invalid = genInvalidValue();
|
||||||
|
|
Loading…
Reference in New Issue