Class baja.coll.Collection
Extends
baja.Simple.
Represents a baja:ICollection in BajaScript.
Collections are usually returned as the result of resolving an ORD (i.e. a BQL query).
Defined in: coll.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
- Fields borrowed from class baja.Value:
- newCopy
- Fields borrowed from class baja.Object:
- equivalent, getIcon
| Method Attributes | Method Name and Description |
|---|---|
|
cursor(obj)
Iterate through a Collection.
|
|
| <private> |
decodeFromString(str)
Decode a Collection from a String.
|
| <private> |
Encode the Collection to a String.
|
| <private> |
make(collData)
Make a Collection.
|
| <private> <static> |
baja.coll.Collection.make(collData)
Make a Collection.
|
- Methods borrowed from class baja.Simple:
- equals
Method Detail
cursor(obj)
Iterate through a Collection.
Please note, this may retrieve data asynchronously.
A function is passed in to retrieve to the Cursor. For example...
myCollection.cursor(function (cursor) {
// Called once we have the Cursor
});
// or via an Object Literal...
myCollection.cursor({
each: function () {
// Called for each item in the Cursor...
var dataFromCursor = this.get();
},
ok: function (cursor) {
// Called once we have the Cursor
},
fail: function (err) {
// Called if any errors in getting data
}
});
- Parameters:
- {Object|Function} obj
- the Object Literal that specifies the method's arguments. For convenience, this can also be the ok function.
- {Function} obj.ok Optional
- called when the cursor has been created with the cursor as an argument.
- {Function} obj.fail Optional
- called if the cursor fails to be retrieved. An error is passed in as the first argument.
- {baja.comm.Batch} obj.batch Optional
- , if specified, the operation will be batched into this object.
- {Function} obj.before Optional
- called just before the Cursor is about to be iterated through.
- {Function} obj.after Optional
- called just after the Cursor has finished iterating.
- {Number} obj.offset Optional
- Specifies the row number to start encoding the result-set from.
- {Number} obj.limit Optional
- Specifies the maximum number of rows that can be encoded. By default, this is set to 10 rows.
- See:
- CollectionCursor
<private>
{baja.coll.Collection}
decodeFromString(str)
Decode a Collection from a String.
- Parameters:
- {String} str
- Returns:
- {baja.coll.Collection}
<private>
{String}
encodeToString()
Encode the Collection to a String.
- Returns:
- {String}
<private>
{baja.coll.Collection}
make(collData)
Make a Collection.
- Parameters:
- {Object} collData
- Returns:
- {baja.coll.Collection} the Collection
<private> <static>
{baja.coll.Collection}
baja.coll.Collection.make(collData)
Make a Collection.
- Parameters:
- {Object} collData
- Returns:
- {baja.coll.Collection} the Collection