This is the Cloudboost query example:
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.
}
});
My question is: How do i display the content of query? When i do it like this
document.write(query);
i get
[object, Object]
If i look in the forum it should be solved with
document.write(JSON.stringify(list));
But that doesn't work. I'm in Monaca (Phonegap).
Query.find function take in an object which contains two callbacks, a success function and an error function. Success function returns a list of CloudObjects and that's what you need. Here's the sample code below :
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.
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With