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

CBL 2.7 and later doesn't catch Illegal top-level key like "_id"

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.0
    • 3.0
    • LiteCore
    • Security Level: Public
    • None
    • Jim 32
    • 3

    Description

      mobile-testkit framework has a generic function to create bulk documents, this function add documents whose data contains a key/value pair like below:

      _id = doc_id_name

      the key _id is considered as an illegal top-level key, 2.6.4.2-1 Android build capture this issue, however, not 2.7 or later CBL fail on this validation during the weekly test run.

      Repro Steps:

      1. use 2.7. or 2.8 CBL Android build
      2. prepare a document like this:
      MutableDocument document = new MutableDocument(id, data);
      in this case, set id = cbl_1
      and data = {channels=[ABC], dict_with_list=

      {list=[true, false]}

      , dict=

      {name=zFakpGdcYp}

      , list=[2115284486470778685, 1745721136811925734], date_time_added=2020-04-15 11:55:22.303358, list_of_dicts=[

      {friend_one=QYLGYazGqd}

      ,

      {friend_two=VQYPpYGBJe}

      ], _id=cbl_1, updates=0}
      3. call database.save(document)

      Expected Result:
      save function throws exception:
      CouchbaseLiteException

      {CouchbaseLite,5,'Illegal top-level key `_id` in document'}

      at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:81)
      at com.couchbase.lite.CBLStatus.convertException(CBLStatus.java:32)
      at com.couchbase.lite.AbstractDatabase.saveInTransaction(AbstractDatabase.java:1460)
      at com.couchbase.lite.AbstractDatabase.saveInternal(AbstractDatabase.java:1366)
      at com.couchbase.lite.AbstractDatabase.save(AbstractDatabase.java:399)
      at com.couchbase.lite.Database.save(Database.java:31)
      .......

      Actual Result:
      document is saved successfully, no validation check placed/failed

      Attachments

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

        Activity

          eunice.huang Eunice Huang (Inactive) created issue -
          eunice.huang Eunice Huang (Inactive) made changes -
          Field Original Value New Value
          Attachment android logcat 2.7.txt [ 91057 ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Attachment python console 2.7.txt [ 91058 ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Link This issue relates to CBL-858 [ CBL-858 ]
          daniel.petersen Daniel Petersen made changes -
          Story Points 3
          daniel.petersen Daniel Petersen made changes -
          Assignee The Lite [ cbgto ] Jim Borden [ jimb ]
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 20 [ 1063 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 20 [ 1063 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked higher
          jimb Jim Borden made changes -
          Fix Version/s Lithium [ 16190 ]
          Fix Version/s Hydrogen [ 16189 ]
          daniel.petersen Daniel Petersen made changes -
          Security Private [ 10332 ] Public [ 10333 ]
          daniel.petersen Daniel Petersen made changes -
          Sprint Jim 32 [ 1279 ]
          daniel.petersen Daniel Petersen made changes -
          Rank Ranked lower
          jimb Jim Borden made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Automated transition triggered when Jim Borden created pull request #1076 in GitHub -
          Status In Progress [ 3 ] In Review [ 10107 ]
          Automated transition triggered when Jim Borden merged pull request #1076 in GitHub -
          Resolution Fixed [ 1 ]
          Status In Review [ 10107 ] Resolved [ 5 ]
          jimb Jim Borden made changes -
          Assignee Jim Borden [ jimb ] Eunice Huang [ eunice.huang ]
          eunice.huang Eunice Huang (Inactive) made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

          People

            eunice.huang Eunice Huang (Inactive)
            eunice.huang Eunice Huang (Inactive)
            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