Search code examples
javascriptparse-platformparse-server

Parse-JS-SDK, the matchesKeyInQuery not work with objectId。


javascript "parse-server": "^2.6.3", "parse": "^1.10.0",

I have three Table, MemberCircle and MemberCircle

Circle has a pointer field named member,it means who create the circle

And MemberCircle has two pointer filed, member and circle。 the member means who join the circle。

I want to query the circles which the member create and join。but the matchesKeyInQuery seens not work with the objectId

const member = new Parse.Object('Member')
member.id = 'memberid'
const queryPage = new Parse.Query('Circle')
const queryOwn = queryPage.equalTo('member', member).equalTo('status', 1)
const queryJoin = new Parse.Query('Circle').matchesKeyInQuery('objectId', 'circle', new Parse.Query('MemberCircle').equalTo('member', member))

Parse.Query.or(queryOwn, queryJoin).limit(15).skip(prePage * pageSize)

How to write the query?


Solution

  • Using matchesKeyInQuery with objectId is now possible using dot notation in the latest release of parse-server 2.7.2.

    Replace the query-key 'circle' with 'circle.objectId'

    Here is this pull request to parse-server that addressed this.