Query on pointer in parse.com Objects in Javascript -


i have class of company has user pointers. query want on company class this:

retrieve company rows user object has name equal 'abc'

so, how should form query ?

var company = parse.object.extend("company"); var query = parse.query(company); query.include("user");  query.equalto("name")       ???? 

is possible write such request in single query ? thanks.

you'll need query user first based on name of "abc". in success callback of query, query on company table using objectid returned user query. this:

var userquery = parse.query('_user'); var companyquery = parse.query('company');  userquery.equalto('name', 'abc');  userquery.find({   success: function(user) {     var userpointer = {       __type: 'pointer',       classname: '_user',       objectid: user.id     }      companyquery.equalto('user', userpointer);      companyquery.find({       success: function(company) {         // whatever       },       error: function() {       }     });   },   error: function() {   } }); 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -