javascript - Parse.com relations count -


i want query object parse db through javascript, has 1 of specific relation object. how can criteria achieved? tried this, equalto() acts "contains" , it's not i'm looking for, code far, doesn't work:

var query = new parse.query("item"); query.equalto("relateditems", someitem); query.lessthan("relateditems", 2); 

it seems parse not provide easy way this.

without other fields, if know items following:

var innerquery = new parse.query('item'); innerquery.containedin('relateditems', [all items except someitem]); var query = new parse.query('item'); query.equalto('relateditems', someitem); query.doesnotmatchkeyinquery('objectid', 'objectid', innerquery);     ... 

otherwise, might need records , filtering.

update

because of data type relation, there no ways include relation content results, need query relation content.

the workaround might add itemcount column , keep updated whenever item relation modified , do:

query.equalto('relateditems', someitem); query.equalto('itemcount', 1); 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -