I have 3 classes (Survey, SurveyItem, VoteSurvey)
i need to include all the surveys that i haven't voted for.
//survey
var surveyQuery = new Parse.Query(Survey);
surveyQuery.equalTo("condo",pointerCondo); //essential column filter
//surveyitem
var surveyItemQuery = new Parse.Query(SurveyItem);
surveyItemQuery.matchesQuery("survey",surveyQuery);
//all survey with filter & surveyitems (return ok)
var voteQuery = new Parse.Query(VoteSurvey);
//...
can anyone help me?
It's not entirely clear what your class structure and fields are, so their might be a better way to do this. But, how about querying for all the surveys you have voted for and then finding all surveys that don't match? For example:
var voteQuery = new Parse.Query('VoteSurvey');
voteQuery.equalTo('user', user);
voteQuery.find().then(function(results) {
var alreadyVotedSurveyIds = [];
for (var i=0; i<results.length; i++) {
alreadyVotedSurveyIds.push(results[i].get('survey').id);
}
var surveyQuery = new Parse.Query('Survey');
surveyQuery.notContainedIn('objectId', alreadyVotedSurveyIds);
return surveyQuery.find();
}).then(function(notVotedSurveys) {
// notVotedSurveys is the array of surveys not voted for
});
Note: keep in mind that Parse query has a default limit of 100.