Strange behaviour with multiple elements on first level in contents
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
U1DB Qt/ QML |
Fix Committed
|
High
|
Cris Dywan | ||
u1db-qt (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I recognized some very strange behaviours concerning multiple elements on the first level in "contents" of a document. Here is what I managed to reproduce:
The example http://
(0) 'Hello World 1'
(1) 'Hello World 2'
(2) 'Hello World 2.5'
(3) 'Hello World 3'
(4) 'Hello World 3.33'
(5) 'Hello World 3.66'
If I now change the structure to have both "message" and "id" as a first level element, like this:
U1db.Document {
docId: 'helloworld1'
create: true
}
docId: 'helloworld2'
create: true
}
docId: 'helloworld3'
create: true
}
U1db.Index{
id: by_helloworld
}
U1db.Query{
id: aQuery
index: by_helloworld
}
I get this output:
(0) 'undefined 1'
(1) 'undefined 2'
(2) 'undefined 3'
JSON.stringify(
{"index"
Making "message" an Integer or "id" a String doesn’t change anything: "message" is undefined while "id" works. Swapping "message" and "id" in contents ({ "id": 3, "message":"Hello World" } instead of { "message": "Hello World", "id":3 }) doesn’t change anything, either.
But now, things are getting very strange, if i don’t call "message" "message" anymore, but "dj", like this:
import QtQuick 2.0
import U1db 1.0 as U1db
import Ubuntu.Components 0.1
MainView {
width: units.gu(45)
height: units.gu(80)
id: aDatabase
path: "aDatabase5"
}
docId: 'helloworld1'
create: true
}
docId: 'helloworld2'
create: true
}
docId: 'helloworld3'
create: true
}
U1db.Index{
id: by_helloworld
}
U1db.Query{
id: aQuery
index: by_helloworld
}
Tabs {
id: tabs
Tab {
}
}
}
}
}
In that case, all of a sudden, you can see "dj", while "id" is undefined:
(0) 'Hello World undefined'
(1) 'Hello World undefined'
(2) 'Hello World undefined'
JSON.stringify(
{"index"
As above, changing the type of the variables or swapping their order doesn’t change a thing.
Related branches
- U1DB Qt developers: Pending requested
-
Diff: 145 lines (+85/-3)3 files modifiedsrc/index.cpp (+4/-1)
src/query.cpp (+2/-2)
tests/tst_query.qml (+79/-0)
- Benjamin Zeller: Approve
- PS Jenkins bot: Approve (continuous-integration)
-
Diff: 525 lines (+219/-135)3 files modifiedsrc/query.cpp (+66/-114)
src/query.h (+3/-1)
tests/tst_query.qml (+150/-20)
Changed in u1db-qt: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in u1db-qt: | |
milestone: | none → 1.0 |
assignee: | nobody → Christian Dywan (kalikiana) |
All of the above works as expected if you have one element on the first level an the other elements are children of the one element.