javascript - Parse query AND operator on the server -


i'm using parse send push notifications , need send users subscribed 2 channels: 1 main channel , @ least 1 of list of secondary channels. tried use 1 query suggested in parse forum didn't work :(

//query main channel var query1 = new parse.query(parse.installation); query1.equalto('channels', main); //query secondary channels var query2 = new parse.query(parse.installation); query2.containedin('channels', secondarylist); //desired result parsequery mainquery = parsequery.and(query1, query2); parse.push.send({                where: mainquery,               data: {                 alert: req.body.message,                 uri: req.body.url              }             }, {               success: function() {                 console.log("push successful");               },               error: function(error) {                 console.error(error);               }             }); 

no such thing query.and(). conjunction qualifying single query:

var justonequery = new parse.query(parse.installation); justonequery.equalto('channels', main); justonequery.containedin('channels', secondarylist); parse.push.send({            where: justonequery,           // ... 

since both tests contents of channels column, presumably array, single query can qualified single condition:

var main = "foo"; var secondarylist = ["bar", "baz"]; var singlelist = secondarylist.concat(main);  // 1 constraint same other 2 justonequery.containedin('channels', singlelist);  // or same thing 3 equalto justonequery.equalto('channels', "foo"); justonequery.equalto('channels', "bar"); justonequery.equalto('channels', "baz"); 

i suggest query working above, few hard-coded variables know in data. once know query works, can concentrate on making sure call function properly.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -