I have a "Product" collection that has a pointer reference to a "Category" collection that I include on a product query. How do I query on this category value, without first querying the category itself separately?
var productQuery = new Parse.Query("Product");
productQuery.include("category");
if(params.category) {
productQuery.equalTo("category", params.category);
}
...
productQuery.find({
success: function(products) {...},
error: function(err) {...}
});
what do not want:
var productQuery = new Parse.Query("Product");
productQuery.include("category");
if(params.category) {
var categoryQuery = new Parse.Query("Category");
categoryQuery.equalTo("name", params.category);
categoryQuery.first({
success: function(foundCategory) {
productQuery.equalTo("category", foundCategory);
}
});
// Yes, I am aware that in this example the product query below would likely be executed before the category query above finishes.
}
...
productQuery.find({
success: function(products) {...},
error: function(err) {...}
});