I'm doing a CloudKit JS web app.
I'm facing a problem doing a query with the comparator IN. I tried in with different values for the fieldValue property but none of them succeed.
Here is the query:
var publicIDs = ['TEST_ID'];
var query = {
recordType: 'PublicInfo',
filterBy: [{
fieldName: 'publicID',
comparator: 'IN',
fieldValue: { value: publicIDs}
}]
};
publicDB.performQuery(query) ...
When I do that, I get the following error result:
_ckErrorCode: "BAD_REQUEST"
_extensionErrorCode: undefined
_reason: "BadRequestException: Invalid value, expected type STRING but actual value was a list with objects of class java.lang.String"
_recordName: undefined
_redirectURL: undefined
_retryAfter: undefined
_serverErrorCode: "BAD_REQUEST"
_subscriptionID: undefined
_uuid: "5470373b-8665-49a0-8c3c-ebbd4df37bbd"
_zoneID: undefined
message: "BadRequestException: Invalid value, expected type STRING but actual value was a list with objects of class java.lang.String"
If I replace
fieldValue: { value: publicIDs}
with
fieldValue: { value: publicIDs, type: 'list' }
or even
fieldValue: { value: publicIDs, type: 'array' }
I get the following error result:
_ckErrorCode: "BAD_REQUEST"
_extensionErrorCode: undefined
_reason: "BadRequestException: Unexpected input"
_recordName: undefined
_redirectURL: undefined
_retryAfter: undefined
_serverErrorCode: "BAD_REQUEST"
_subscriptionID: undefined
_uuid: "ccb1d8bb-03e6-476b-b111-89fe3cddbf6d"
_zoneID: undefined
message: "BadRequestException: Unexpected input"
If I use the comparator "EQUALS" and a single value instead of an array in the query, I get the correct result without error.
The Cloudkit JS documentation says that we can use the "IN" comparator. But there is no more information, i.e. how to specify the array values in the query.
Does anyone know the correct syntax to use ?