7

これは Cloudboost クエリの例です。

var query = new CB.CloudQuery("Student");
query.equalTo('age', 21); //find all Students who age is 21
query.find({
success: function(list){
//list is an array of CloudObjects
},
error: function(err) {
//Error in retrieving the data.
}
});

私の質問は次のとおりです。クエリの内容を表示するにはどうすればよいですか? こうすると

document.write(query);

私は得る

[object, Object] 

フォーラムを見ると、解決する必要があります

document.write(JSON.stringify(list));

しかし、それはうまくいきません。Monaca (Phonegap) にいます。

4

2 に答える 2

1

Query.find 関数は、成功関数とエラー関数の 2 つのコールバックを含むオブジェクトを受け取ります。Success 関数は CloudObjects のリストを返します。これが必要なものです。以下のサンプルコードは次のとおりです。

var query = new CB.CloudQuery("Student");
query.equalTo('age', 21); //find all Students who age is 21
query.find({
success: function(list){
   console.log(list); //here's the result of the query
},
error: function(err) {
//Error in retrieving the data.
}
});
于 2016-08-08T13:15:13.820 に答える
0

答えは次のようなものです。

document.write(list[0].get('Student'));

JSのゲッターとセッターの部分です。

どうもありがとう @nawaz-cloudboost.io !!

于 2016-08-09T13:22:32.943 に答える