samedi 18 avril 2015

Cursors order in query using composite index

I wonder how records are arranged in queries that use composite indices.


Let's consider this example.



let objetStore = db.createObjectStore('article',{keyPath : 'id'});
objectStore.createIndex('userid-date',['userid','date_created']);

db.transaction('article').objectStore('article').index('userid-date').openCursor(IDBKeyRange.bound([1,new Date(new Date() - 365*86400*1000)],[100,new Date()])).onsuccess = function(e){

};


Are the records in the above query ordered by userid or date_created? Why?


Aucun commentaire:

Enregistrer un commentaire