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

Inconsistent content for views in the same design document

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1
    • Component/s: view-engine
    • Security Level: Public
    • Labels:
      None

      Description

      Steps to reproduce using the gamesim-sample database and the web console:

      1. display results of the playerlist view, it shows 10 items
      2. modify view leaderboard as:

      function (doc, meta) {
      if (meta.id.match(/Aaron/).length)

      { emit(doc.experience, null); }

      }

      3. display results of the leaderboard view; it shows three items
      4. again display the results of the playerlist view, it now shows only three items

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

        Activity

        Hide
        ureczky Balint Ureczky added a comment -

        A Wrong View Ruins other Views...

        Reproduction steps:

        Create some documents, e.g.:
        ======================

        a:

        { "attr1": "a1", "attr2": "a2" }

        b:

        { "attr1": "b1" }

        Create Development Views:

        1. Create a not very safe mapping, when an attribute is used without examining it:
        =========================

        • Design Document Name: _design/dev_main
        • View Name: attr2length
        • Map:
          function (doc, meta) { emit(doc.attr2.length, null); }

        -> Show results:
        Key: "a" (a)
        Value: null

        Bug1:
        --------
        Although, not all of the views has attr2, the result is quite strange, because it filters to the ones which have.
        I expected to get some syntax error or null value or stg.

        2. Create ANY kind of view
        ====================

        • Design Document Name: _design/dev_main
        • View Name: all
        • Map:
          function (doc, meta) { emit(meta.id, null); }

        -> Show results:
        Key: "a", a
        Value: null

        Bug2:
        --------
        It only shows the a, instead of a and b, however we listed all!
        Only those are shown which wasnt fail at the first, so which have attr1 attribute.
        It seems that the first buggy view affected the second one, generally all other, which can be debugged very hard!

        Show
        ureczky Balint Ureczky added a comment - A Wrong View Ruins other Views... Reproduction steps: Create some documents, e.g.: ====================== a: { "attr1": "a1", "attr2": "a2" } b: { "attr1": "b1" } Create Development Views: 1. Create a not very safe mapping, when an attribute is used without examining it: ========================= Design Document Name: _design/dev_main View Name: attr2length Map: function (doc, meta) { emit(doc.attr2.length, null); } -> Show results: Key: "a" (a) Value: null Bug1: -------- Although, not all of the views has attr2, the result is quite strange, because it filters to the ones which have. I expected to get some syntax error or null value or stg. 2. Create ANY kind of view ==================== Design Document Name: _design/dev_main View Name: all Map: function (doc, meta) { emit(meta.id, null); } -> Show results: Key: "a", a Value: null Bug2: -------- It only shows the a, instead of a and b, however we listed all! Only those are shown which wasnt fail at the first, so which have attr1 attribute. It seems that the first buggy view affected the second one, generally all other, which can be debugged very hard!
        Hide
        FilipeManana Filipe Manana (Inactive) added a comment -

        Duplicate of MB-6895.

        You should have an error in the mapreduce.N log file, mentioning an undefined reference error thrown by the JavaScript engine when accessing doc.foo.bar and the foo property doesn't exists.

        Show
        FilipeManana Filipe Manana (Inactive) added a comment - Duplicate of MB-6895 . You should have an error in the mapreduce.N log file, mentioning an undefined reference error thrown by the JavaScript engine when accessing doc.foo.bar and the foo property doesn't exists.

          People

          • Assignee:
            Unassigned
            Reporter:
            schp schp
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Gerrit Reviews

              There are no open Gerrit changes