From ad69f778712dd7de63c17e86f49ed371c1afa432 Mon Sep 17 00:00:00 2001 From: Stephen Mallette Date: Wed, 12 Jun 2024 07:11:47 -0400 Subject: [PATCH] Added merge() example with Map to docs CTR --- docs/src/reference/the-traversal.asciidoc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc index e3d04ec1fa..42fa143fcf 100644 --- a/docs/src/reference/the-traversal.asciidoc +++ b/docs/src/reference/the-traversal.asciidoc @@ -2762,15 +2762,17 @@ link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre [[merge-step]] === Merge Step -The `merge()`-step (*map*) merges the elements of the incoming list traverser and the provided list argument into one -list. This is also known as the union operation. This step only expects list data (array or Iterable) and will throw -an `IllegalArgumentException` if any other type is encountered (including `null`). This differs from the `combine()`-step -in that it doesn't allow duplicates. +The `merge()`-step (*map*) combines collections like lists and maps. It expects an incoming traverser to contain a +collection objection and will combine that object with its specified argument which must be of a matching type. This is +also known as the union operation. If the incoming traverser or its associated argument do not meet the expected type, +the step will throw an `IllegalArgumentException` if any other type is encountered (including `null`). This step differs +from the `combine()`-step in that it doesn't allow duplicates. [gremlin-groovy,modern] ---- g.V().values("name").fold().merge(["james","jen","marko","vadas"]) g.V().values("name").fold().merge(__.constant("james").fold()) +g.V().hasLabel('software').elementMap().merge([year:2009]) ---- *Additional References*