parse.com - Parse Javascript - Relation is not a function -
i'm trying understand how relation works , did wrote simple script:
var parse = require('parse/node'); parse.initialize('myappid'); parse.serverurl = 'http://localhost:1337/parse'; var userquery = new parse.query(parse.user); userquery.equalto('username', 'the_username'); userquery.find() .then(user => { return user; }) .then(user => { var systems = parse.object.extend("systems"); var systemquery = new parse.query(systems); systemquery.equalto('customer', 'mycustomer'); systemquery.find() .then(system => { var relation = user.relation('systems_ref'); // here relation not func relation.add(system); console.log('adding relation'); user.save() .then(response => console.log('user saved')) .catch(error => console.log('error saving', error)); }).catch(error => console.log('error find system', error)); });
but in line try user.relation
have error "relation not function".
i have others example on how create relation, dont see difference in code...
i have user (that sublcass of parseobject), , on i'm trying access relation method...
you may use follows: add post user javascript sdk:
var user = parse.user.current();
var relation = user.relation("posts");
relation.add(post);
user.save();
Comments
Post a Comment