<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>10058</bug_id>
          
          <creation_ts>2010-07-01 06:54:51 +0000</creation_ts>
          <short_desc>Specify order for indexes which contain duplicate key values</short_desc>
          <delta_ts>2010-11-08 11:34:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Indexed Database API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jonas Sicking (Not reading bugmail)">jonas</reporter>
          <assigned_to name="Jonas Sicking (Not reading bugmail)">jonas</assigned_to>
          <cc>jorlow</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>36508</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-07-01 06:54:51 +0000</bug_when>
    <thetext>Consider an objectStore, with keyPath &quot;id&quot;, containing the following objects:

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

And an index keyed on the &quot;name&quot; property. What should the following code alert?

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

Possible imaginable results are:
&quot;1,2,3&quot;
&quot;2,1,3&quot;

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 &quot;1,2,3&quot; would be defined as the correct result.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>41907</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-11-01 04:50:23 +0000</bug_when>
    <thetext>Working at rewriting cursor handling, especially related to indexes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42252</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-11-08 11:34:56 +0000</bug_when>
    <thetext>Should be fixed by http://dvcs.w3.org/hg/IndexedDB/rev/8716288a4fe1

Would be great if someone could check that it looks correct.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>