Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-37157

[CX] extend object_concat to support an input array

    XMLWordPrintable

Details

    • 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

      1. concatenate an arbitrary number of JSON objects into a single object and
      2. 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.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              chanabasappa.ghali Chanabasappa Ghali
              till Till Westmann
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty