Cloudboost.初学者.如何显示查询示例

Cloudboost. Beginner. How to display the query example?

本文关键字:查询 显示 初学者 何显示 Cloudboost      更新时间:2023-09-26

这是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);

i get

[object, Object] 

如果我在论坛上看,应该用

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

但这不起作用。我在摩纳哥(Phonegap)

查询。Find函数接受一个对象,该对象包含两个回调函数,一个成功函数和一个错误函数。Success函数返回一个cloudobject列表,这就是您所需要的。下面是示例代码:

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.
}
});

答案是:

document . write(列表[0]. get("学生")),

是JS中的getter和setter部分

谢谢@nawaz-cloudboost。io ! !