javascript - Parse.com : Fetch all users with no role assigned -


i have users in of users have administrator role assigned them. other users doesn't have role assigned them.

i able fetch users have administrator role assigned them using following code.

var query = new parse.query(parse.role); query.equalto("name", "administrator"); query.first({     success : function(role) {         var relation = role.getusers();         relation.query().find({             success : function(results) {                 console.log(results);             },             error : function(error) {                 console.log(error);             }         });     },     error : function(error) {         console.log(error);     } }); 

how can fetch users whom role not assigned?

try parse.query.notequalto:

var query = new parse.query(parse.role); query.notequalto("name", "administrator"); query.first({     success : function(role) {         var relation = role.getusers();         relation.query().find({             success : function(results) {                 console.log(results);             },             error : function(error) {                 console.log(error);             }         });     },     error : function(error) {         console.log(error);     } }); 

also, maybe these filters may you

query.doesnotexist("name"); query.notcontainedin("role", ["administrator"]); 

https://parse.com/docs/js/guide#queries-query-constraints


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -