Skip to content

Collection

David Fahlander edited this page Mar 28, 2014 · 28 revisions

Represents a collection of database objects. Note that it will not contain any objects by itself. The contained object can only be accessable by calling methods like toArray() or each()

Construction

Collection constructor is private. Instances are returned from the WhereClause methods and some of the Table methods.

Sample

var collection = db.friends.where("name").equalsIgnoreCase("david");

collection.each(function(friend) {
    console.log("Found: " + friend.name + " with phone number " + friend.phone);
});

Methods

and

count

desc

distinct

each

eachKey

eachUniqueKey

first

keys

last

limit

offset

or

sortBy

toArray

uniqueKeys

Clone this wiki locally