Skip to content

Instantly share code, notes, and snippets.

@YutaWatanabe
Created August 28, 2014 09:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YutaWatanabe/0e248e77dd1bf84975f9 to your computer and use it in GitHub Desktop.
Save YutaWatanabe/0e248e77dd1bf84975f9 to your computer and use it in GitHub Desktop.
data read method of azure mobile services
// テーブルのすべての項目の読出します
itemTable.read()
.then(function(items){
// 配列で項目が返ってきます
$each(items, function(i, e){
// 項目 i に対する処理
});
});
// 条件を指定して項目を読み出します
itemTable.where({text: "Sample Item"}).read()
.then(function(items){
//配列で該当する項目が返ってきます
console.log(items);
});
// 取得する項目の数を指定してみます
itemTable.take(5).read()
.then(function(items){
//上位5つの項目を取得します
console.log(items);
});
// where と組み合わせたり skip() 途中から読み込みます
itemTable.where({text: "Sample Item"}).skip(5).take(5).read()
.then(function(items){
//上位から5つ飛ばして、その次から5つの項目を取得します
console.log(items);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment