Reputation: 1046
I implemented a query for chat messages in PARSE using their REST API. My problem is, I am getting messages where somehow sender and receiver was the same.
Clearly a bug or a test in the debug version. Anyway, those messages should not get displayed.
Obviously I want to fix that by changing my PARSE Query and not go through all the messages and delete the wrong ones. Is that even possible? I am not very good with the PARSE REST API.
This is what I am passing to PARSE API:
$aWhere = array(
self::FIELD_SENDER => array('$in' => array($sUsername1, $sUsername2)),
self::FIELD_RECEIVER => array('$in' => array($sUsername1, $sUsername2)),
);
$url = 'https://api.parse.com/1/classes/test?where='.json_encode($aWhere);
url then gets passed into CURL
I want to avoid messages where self::FIELD_SENDER
is $sUsername1
AND self::FIELD_RECEIVER
is $sUsername1
and the same goes in respect to $sUsername2
.
Upvotes: 1
Views: 131
Reputation: 16874
I strongly recommend you instead fix your data using a Job.
As for what you are asking for, you can't quite get what you want. Let's explore the logic:
This may seem like it will give the results you want, except the situation excluded by Query1 is satisfied by Query2 and vice versa.
What about using $nin (not in):
Unfortunately this will also exclude the following messages:
Upvotes: 1