Comments (4)
Don't think the number of indexes are any problems. I'll do a unit test to
reproduce it next week (holiday right now). Did you miss to index 'age' or
is it just a typo? Do you get any error if adding a final .catch() at the
end?
Den 24 jul 2014 17:35 skrev "salles" [email protected]:
hi, just wanted to check wether i am doing something wrong to get such
"unstable" results.i have played with dexie on top of Chrome and FFOS, as well as the webview
on Android 4.1.2 up to 4.4 Kitkat, and on all of them the results of a
query like belowdb.phones.where('name').startsWithIgnoreCase('moto'));
it seems to increase the occurrence, and even not responding at all when
the OR clause is included in the query chain.db.phones.where('name').startsWithIgnoreCase('moto')).or('age').below('10'));
the only creepy thing i have done was creating a lot of indexes...(14) too
much ?var dbi = new Dexie("MyDB"); dbi.version(1).stores({ phones: "++id, additionalFeatures, android, availability, battery, camera, connectivity, description, display, hardware, id, images, name, sizeAndWeight, storage" });
—
Reply to this email directly or view it on GitHub
#15.
from dexie.js.
Could you describe how it increases the occurrence? Are you using toArray () or each() to get the results? The or method may (and usually does) produce the results in random order, but should never give different results.
If you have a chance to provide a sample code and data to reproduce it that would be very helpful.
Thanks,
David
from dexie.js.
I could not reproduce the error. I replaced "age" with "id" to make the query on a registered index. Otherwise the query would fail each time with "NotFoundError" becuase the index "age" wasn't found. When using an existing index I always get the same results. I've tested in Chrome 36.0.1985.125, Opera 22.0.1471.70, Firefox 30 and IE11.
I belive your error could be due to an error from an earlier write operaion you've made and did not wait for to finish. Check what happens if you catch your write operations performed prior to executing your or() query. When you start your query using the or() operation, the earlier write operation has not yet failed. When it fails, one of the or() parts will fail with the real error and the other with an "AbortError". Which one that gets the first error may vary. If you catch your or() operation you may get the actual error, or the AbortError. But the best thing is to catch the earlier write operations to see where they fail. These are my guesses and only a therory since I could not reproduce the error.
In my test, I could execute 10 simiultanous queries with the or() method applied, as well as executing the in sequence. Each time I run the unit test I get the same results. Here's the code:
asyncTest("or-issue#15-test", function () {
var db = new Dexie("MyDB_issue15");
db.version(1).stores({
phones: "++id, additionalFeatures, android, availability, battery, camera, connectivity, description, display, hardware, id, images, name, sizeAndWeight, storage"
});
db.on('populate', function () {
ok(true, "on(populate) called");
for (var i = 0; i < 100; ++i) {
db.phones.add({ name: "Name" + randomString(16), additionalFeatures: [randomString(10)], android: 1, availability: 0, battery: 1, camera: 1 });
}
function randomString(count) {
var ms = [];
for (var i = 0; i < count; ++i) {
ms.push(String.fromCharCode(32 + Math.floor(Math.random() * 96)));
}
return ms.join('');
}
});
db.open().catch(function (err) {
ok(false, "DB ERROR: " + err);
});
var numRuns = 10;
for (var i = 0; i < numRuns; ++i) {
db.phones.where("name").startsWithIgnoreCase("name").or("id").below(50).toArray(function (a) {
equal(a.length, 100, "Found 100 phones");
}).catch(function (err) {
ok(false, "error:" + err);
}).finally(function () {
if (--numRuns == 0) {
// All test runs finished. Delete DB and exit unit test.
db.delete();
start();
}
});
}
});
If you have some code to reproduce the error, your welcome and I will debug it for you, otherwise I will close this issue within some days.
Thanks,
David
from dexie.js.
hi, thanks for your detailed analysis and commitment to help !
i have indeed missed the 'age' indexing which might have been the source of the problem.
from dexie.js.
Related Issues (20)
- Guidance for multi-lingual dexie database
- Transaction.table() is missing generic overload with insert type
- Seeking Guidance for Serverless Bi-directional Sync Between Two Dexie.js Instances HOT 7
- Dexie Cloud Feature request: user-specific public realm HOT 1
- Is it possible to invite a user who is not signed up? HOT 6
- Error: too much recursion HOT 1
- Typescript returns errors regarding ID that is undefined HOT 11
- bulkDelete() for large number of primary keys is way too slow HOT 1
- WebPush for DexieCloud Feature Request HOT 3
- Dexie Cloud feature request: in-app invitations HOT 1
- dexie cloud db entries with image blob disapear HOT 3
- Return only one field? HOT 6
- Typescript complain with compound ID HOT 2
- related tables in dexie HOT 2
- Dexie Cloud Manager - "Manage users" error HOT 3
- Authentication error with the fresh.deno framework HOT 1
- Issue with Dexie's table.where() Method when Targeting Existing IndexedDB with Indexed KeyPath
- "default" is not exported by "../../../Dexie.js/dist/dexie.min.js", imported by "../../../Dexie.js/import-wrapper-prod.mjs". HOT 17
- Transaction context is lost when running a recursive call in a loop HOT 8
- Backwards compatibility issue - ReferenceError: queueMicrotask is not defined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dexie.js.