diff --git a/src/IDBIndex.js b/src/IDBIndex.js index 1fde55f1..9ad99b5b 100644 --- a/src/IDBIndex.js +++ b/src/IDBIndex.js @@ -651,6 +651,9 @@ function buildFetchIndexDataSQL (nullDisallowed, index, range, opType, multiChec setSQLForKeyRange(convertedRange, util.escapeIndexNameForSQL(index.name), sql, sqlValues, true, false); } } + if (opType !== 'count') { + sql.push('ORDER BY', util.escapeIndexNameForSQL(index.name), ',', util.sqlQuote('key')); + } return [nullDisallowed, index, hasRange, range, opType, multiChecks, sql, sqlValues]; }