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
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
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!