Uploaded image for project: 'Couchbase Lite'
  1. Couchbase Lite
  2. CBL-3087

ARRAY_COUNT() returns incorrect result

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.1.0
    • 3.0.1
    • LiteCore
    • Security Level: Public
    • None
    • 2

    Description

      Reported in https://github.com/couchbase/couchbase-lite-C/issues/297.

      MutableDocument mutableDocA = new MutableDocument("test2","{\"names\":[null, 'abc','def', null, 'ghi'],\"ID\":\"test2\"}");
      database.save(mutableDocA);
       
      Query query = database.createQuery("SELECT ARRAY_IFNULL(names) AS NONNULL, ARRAY_COUNT(names) AS COUNT, ARRAY_LENGTH(names) AS LENGTH FROM _ WHERE META().id = 'test2'");
       
      ResultSet rs = query.execute();
      for (Result result : rs) {
          Log.i(TAG, String.format("TEST JSON: %s", result.toJSON()));
      }
      

      Result:

      I/CBM: TEST JSON: {"NONNULL":"abc","COUNT":5,"LENGTH":5}
      

      Attachments

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

        Activity

          People

            jimb Jim Borden
            pasin Pasin Suriyentrakorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty