Query object
The feature described in this topic is available only in preview. To use this feature and other new Windows Azure capabilities, sign up for the free preview.
Provides functionality for querying Windows Azure Mobile Services.
This object contains the following members:
Methods
| Syntax | Returns | Description | ||
|---|---|---|---|---|
|
orderBy |
|
|
||
|
|
Query |
Returns a Query object where the query is ordered by the supplied column name arguments, in ascending order. friendsTable.orderBy('name') .read({ success: function(results) { … }}); |
||
|
orderByDescending |
|
|
||
|
|
Query |
Returns a Query object where the query is ordered by the supplied column name arguments, in descending order. friendsTable.orderByDescending('name') .read({ success: function(results) { … }}); |
||
|
read |
|
|
||
|
|
undefined |
Reads all data from the table and invokes the success handler specified on the options parameter passing in an array of results.
|
||
|
select |
|
|
||
|
|
Query |
Returns a Query object with the requested column projection applied. friendsTable.select('friendId', 'approved') .read({ success: function(results) { console.log(results) }}); |
||
|
|
Query |
Returns a Query object with the requested function projection applied. friendsTable.select(function() { return this.friendId; }) .read({ success: function(results) { console.log(results); }}); |
||
|
skip |
|
|
||
|
|
Query |
Returns a Query object that skips the first recordCount number of records. |
||
|
take |
|
|
||
|
|
Query |
Returns a Query object that returns the recordCount number of records. |
||
|
where |
|
|
||
|
|
Query |
Returns a Query object that is filtered based on the property values of the supplied JSON object.
friendsTable.where({ userId: user.userId, approved: true})
.read({ success: function(results) { … }});
|
||
|
|
Query |
Returns a new Query object that is filtered based on the supplied function. friendsTable.where(function(currentUserId){ return this.userId == currentUserId && this.approved == true; }, user.userId) .read({ success: function(results) { … }}); |
||
The Query object is passed to read scripts.
Query methods (orderBy, orderByDescending, select, skip, take and where all return a new Query object. This enables you to compose queries as a series of method calls.
Important