android - Parse.com equivalent to sql query -
i want know how can achieve following sql query on parse,
e.g. assume have 2 tables/classes in our db: user, profile example values in brackets.
user - email(tt@tt.com) - name(tt) profile -email(tt@tt.com) -age(23) sql query, select user.email,user.name,profile.age user join profile on user.email = profile.email user.email = 'tt@tt.com'
the resulting recordset "tt@tt.com,tt,23e"
. now, if want make same thing parse, or better, how can achieve this?? read these structures don't know if apply case , how use them. i'm developing in android appreciated.
if have pointers _users
on class profile
best method 1 :
var profile = parse.object.extend("profile"); var query = new parse.query(profile); query.equalto("email", request.params.email); return query.first().then(null, function(error) { return parse.promise.error('sorry, profile not found.'); }).then(function(profile) { profile.get('_user').fetch().then(function(user) { console.log( 'name : ' + user.get('name') + ' ' + 'age : ' + profile.get('age') ); }); });
note profile.get('_user')
pointer's name may change , not _user
Comments
Post a Comment