Uploaded image for project: 'Couchbase Documentation'
  1. Couchbase Documentation
  2. DOC-8806

Add OBJECT_FIELD function

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • Neo.M1
    • Neo
    • query
    • None
    • DOC-2022-S9
    • 1

    Description

      A function OBJECT_FIELD has been added and needs to be documented along with the other OBJECT_ functions https://docs.couchbase.com/server/7.0/n1ql/n1ql-language-reference/objectfun.html.

       

      OBJECT_FIELD(object, string-field-name)

      The function extracts the value for the given field name from the object if it exists.  This may be a nested field name but must be provided in the string as would be addressed outside the string, e.g. "`field name with spaces`" (note the embedded back quotes).

       

      OBJECT_PATHS() returns possible valid field names for an object, e.g.

       

      select object_paths(default) from default use keys['Weston_3077363'];
      ...
          "results": [
          {
              "$1": [
                  "doc_type",
      ...
                  "shipped_order_history[3].order_datetime",
                  "shipped_order_history[3].order_id"
              ]
      ...
      

      select object_field(default,"shipped_order_history[3].order_datetime") from default use keys['Weston_3077363'];
      ...
          "results": [
          {
              "$1": "Wed Sep  4 08:22:23 2013"
      ...
      

       

      Attachments

        Issue Links

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

          Activity

            People

              simon.dew Simon Dew
              Donald.haggart Donald Haggart
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty