-
-
Notifications
You must be signed in to change notification settings - Fork 641
WhereClause.noneOf()
table.where(indexOrPrimKey).noneOf([key1, key2, keyN, ...])
indexOrPrimKey: String | Name of an index or primary key registered in Version.stores() |
key | Array of keys to compare with. Each key MUST be a Number, String, Date or Array instance. Booleans are not accepted as valid keys |
Collection or WriteableCollection depending on table type
Queries the collection for all valid values that does not match given value. Note that you will only find values that are valid indexedDB keys.
Given the following data:
{ id: 1, shoeSize: 9 }
{ id: 2, shoeSize: 10 }
{ id: 3, shoeSize: 11 }
{ id: 4 }
{ id: 5, shoeSize: null }
{ id: 6, shoeSize: "abc" }
{ id: 7, shoeSize: false }
{ id: 8, shoeSize: ["a","b","c"]}
And the following query:
db.people.where('shoeSize').noneOf([10,11]).each(function(x) {
console.log("Found: " + JSON.stringify(x));
});
We get the following result:
Found: "{id:1,shoeSize:9}"
Found: "{id:6,shoeSize:\"abc\"}"
Found: "{id:8,shoeSize:[\"a\",\"b\",\"c\"]}"
Note that id 4, 5 and 7 wasn't included in the result. This is because only items where shoeSize points to a valid key will be included in the result. A valid key is a key of type string, number, Date or Array<string | number | Date>.
In Dexie version < 1.3.0, WhereClause.noneOf() will launch a parallell query for each item being searched for so it is not suited for looking for large sets. This has been improved in Dexie v1.3.0 (can be previewed in branch "es6").
Also notice that WhereClause.noneOf() will NOT find records with invalid keys, such as null, booleans, undefined etc. It can only search keys that indexedDB supports: string, number, Date or Array<string | number | Date>.
Dexie.js - minimalistic and bullet proof indexedDB library