-
-
Notifications
You must be signed in to change notification settings - Fork 641
Collection
Represents a collection of database objects. Note that it will not contain any objects by itself. Instead, it yields a preparation for how to execute a DB query. A query will be executed when calling methods like toArray(), each(), eachKey, eachUniqueKey(), keys() and uniqueKeys().
- Collection
Collection constructor is private. Instances are returned from the WhereClause methods and some of the Table methods.
var collection = db.friends.where("name").equalsIgnoreCase("david");
collection.each(function(friend) {
console.log("Found: " + friend.name + " with phone number " + friend.phone);
});
Add JS based criteria to collection
Get the number of items in the collection
Sort in descending order
Remove duplicates of items with same primary key
Execute query and call a function for each item
Execute query on the index or primary key being used and call a function for each key
Execute query on the index or primary key being used and call a function for each unique key
Get the first item in the collection
Retrieve an array containing all keys of the collection (index or primary key depending on where() clause)
Get the last item in the collection
Limit the result to given number of items
Ignore N items before given offset and return the rest
Logical OR operation
Reverse the order of items.
Execute query and get an array with the results sorted by given property
Execute query and get an array with the results sorted by the index used in the where() clause
Retrieve an array containing all unique keys of the collection (index or primary key depending on where() clause)
Ignores items occurring after given filter returns true.
Dexie.js - minimalistic and bullet proof indexedDB library