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

Error: function field-access-by-name expects its 1st input parameter to be type object but the actual input type is string

    XMLWordPrintable

Details

    • Untriaged
    • No
    • CX Sprint 111, CX Sprint 112, CX Sprint 114, CX Sprint 115, CX Sprint 141, CX Sprint 142

    Description

      Original Query:

      SELECT name FROM default_shadow WHERE ANY x IN ["Support","Management"] SATISFIES job_title = x END ORDER BY name;
      

      This works fine in N1QL but cbas throws an error.
      If we refer job_title with dataset name it works fine, without that query parser considers it as string.

      Modified Query:

      SELECT name FROM default_shadow WHERE ANY x IN ["Support","Management"] SATISFIES default_shadow.job_title = x END ORDER BY name;
      

      Here job_title is of type String in the document.

      Another example is:

      SELECT name,email FROM default_shadow WHERE (ANY skill IN default_shadow.skills SATISFIES skill = 'skill2010' END)
      

      Here skills is an json array and comparison is happening between two strings as it was in the previous case and it is working properly.

      Sample Document:

      {
        "mutated": 0,
        "test_rate": 11.11,
        "join_mo": 11,
        "join_day": 21,
        "skills": [
          "skill2010",
          "skill2011"
        ],
        "hikes": [
          20,
          10,
          15
        ],
        "permanent": 1,
        "tasks_points": {
          "task1": 1,
          "task2": 1
        },
        "join_yr": 2010,
        "name": "employee-21",
        "_id": "query-testemployee58360.6484454-0",
        "job_title": "Support",
        "VMs": [
          {
            "name": "vm_11",
            "memory": 11,
            "os": "ubuntu",
            "RAM": 11
          },
          {
            "name": "vm_12",
            "memory": 11,
            "os": "windows",
            "RAM": 11
          }
        ],
        "email": "21-mail@couchbase.com"
      }
      

      Attachments

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

        Activity

          People

            dmitry.lychagin Dmitry Lychagin (Inactive)
            ritesh.agarwal Ritesh Agarwal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty