W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

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

From: <bugzilla@jessica.w3.org>
Date: Thu, 01 Jul 2010 06:54:51 +0000
To: public-webapps@w3.org
Message-ID: <bug-10058-2927@http.www.w3.org/Bugs/Public/>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:39 GMT