[Bug 10058] New: Specify order for indexes which contain duplicate key values

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10058

           Summary: Specify order for indexes which contain duplicate key
                    values
           Product: WebAppsWG
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Indexed Database API
        AssignedTo: nikunj.mehta@oracle.com
        ReportedBy: jonas@sicking.cc
         QAContact: member-webapi-cvs@w3.org
                CC: mike@w3.org, public-webapps@w3.org


Consider an objectStore, with keyPath "id", containing the following objects:

{ id: 1, name: "foo", flags: ["hi", "low"] }
{ id: 2, name: "foo", flags: ["apple", "orange"] }
{ id: 3, name: "goo", flags: ["fahrvergnügen"] }

And an index keyed on the "name" property. What should the following code
alert?

results = [];
db.objectStore("myObjectStore").index("nameIndex").openCursor().onsuccess =
function(e) {
 cursor = e.result;
 if (!cursor) {
   alert(results);
 }
 results.push(cursor.value);
 cursor.continue();
};

Possible imaginable results are:
"1,2,3"
"2,1,3"

In order to keep results consistent and predictable we should define that one
of these results are correct, and define which one that is. I would recommend
that indexes with duplicate values should be defined to be ordered by the key
order in the objectStore. I.e. in this case "1,2,3" would be defined as the
correct result.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Received on Thursday, 1 July 2010 06:54:54 UTC