Details
-
Improvement
-
Resolution: Done
-
Critical
-
6.5.1
-
CX Sprint 181, CX Sprint 182, CX Sprint 183, CX Sprint 184, CX Sprint 185, CX Sprint 186, CX Sprint 187, CX Sprint 188, CX Sprint 189, CX Sprint 190, CX Sprint 191, CX Sprint 192, CX Sprint 193, CX Sprint 197, CX Sprint 198, CX Sprint 199, CX Sprint 200, CX Sprint 201, CX Sprint 202, CX Sprint 203, CX Sprint 204, CX Sprint 205, CX Sprint 274
Description
Currently the function object_concat takes an arbitrary but fixed number of JSON objects as parameters and aggregates them to one JSON object that contains all key-value pairs of the input JSON objects.
To support more dynamic uses of the function, we should also support passing an array of objects as a (single) parameter. This allows us to
- concatenate an arbitrary number of JSON objects into a single object and
- the sequence of input objects can be computed at runtime (e.g. by a subquery).
This allows us to dynamically create new objects. E.g.
SELECT VALUE OBJECT_CONCAT([{"name1":"val1"},{"name2":"val2"}])
|
would yield
[
|
{
|
"name1": "val1",
|
"name2": "val2"
|
}
|
]
|
just like
SELECT VALUE OBJECT o.name: o.val FOR o IN
|
[{"name":"name1","val":"val1"},{"name":"name2","val":"val2"}]
|
END
|
which uses the more general OBJECT constructor functionality that is available in the Query Service.