I have two related objects (Shop and Item). Item object has a field containing its Shop object.
How to create a parseQuery
to get all shops having at least one item.
I have two related objects (Shop and Item). Item object has a field containing its Shop object.
How to create a parseQuery
to get all shops having at least one item.
You have to write a cloud code Elnaz jan and then query there. Something like this below. However, first put a column as itemNumber with a 0 value. When a new item is saved then change that one to 1. This way you will know on your return that there should be an item there. I think with the SDK you can query in your own code without haing to go to cloud code. Either way works.
Parse.Cloud.define("getFeatured", function(request, response) {
var query = new Parse.Query("allCars");
query.equalTo("itemNumber", 1) ;
query.find({
success: function(results) {
response.success(results);
},
error: function() {
response.error("lookup failed");
}
});
});