CloudKit JS - Queries with IN comparator do not work
Originator: | marcjordant | ||
Number: | rdar://23687098 | Date Originated: | 30/11/2015 |
Status: | Open | Resolved: | |
Product: | Other | Product Version: | |
Classification: | Reproducible: | ALways |
When doing a CloudKit JS query with a IN comparator, the query fails and return an error. Steps to Reproduce: Create the query using a IN comparator and an array for the value, then executing the query: var publicIDs = ['TEST_ID']; var query = { recordType: 'PublicInfo', filterBy: [{ fieldName: 'publicID', comparator: 'IN', fieldValue: { value: publicIDs} }] }; publicDB.performQuery(query) Expected Results: The records matching the query Actual Results: an error: _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" Version: The actual version of CloudKit JS as the javascript is included in the html file: <script src="https://cdn.apple-cloudkit.com/ck/1/cloudkit.js"></script> Notes: I tried many combinations for the 'fieldValue' value, none of them succeed: fieldValue: { value: publicIDs} or fieldValue: { value: publicIDs, type: 'list' } or fieldValue: { value: publicIDs, type: 'array' } When replacing the IN comparator with a EQUALS comparator and giving a single value for the 'fieldValue' value, everything works correctly.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!