I have seen the tutorial but its not clear to me how to handle the following problem and optimize my query. I am doing a query inside a query for each item, and of course this is not fine since I am sure it can be done with one query.
I have the following objects:
User - a User logged in using FB logging
Publication - a publication created by the user (has a field called createdBy with a pointer to the user
Parse.Installation - the Installation object to create a push, has a reference to the user.
Right now what I am doing is a query by date, looking for expired publications as follows:
var Publication = Parse.Object.extend("Publication");
var query = new Parse.Query(Publication);
//calculate the date here......
query.lessThan("createdAt", expirationDate);
query.find({
success: function(results) {//here I have all the publications.
//Now I get the user
var aPub = results[i];
var user = aPub.get('createdBy');
var query2 = new Parse.Query(Parse.Installation);
query2.equalTo('user', user);//and now I send the push for EACH user
Parse.Push.send({
where: query2,
data: {....
...
...
I am sure this can be done with one query but I don't understand how.
Thanks.