<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "CloudKitJS",
  "identifier" : "/documentation/CloudKitJS/CloudKit.Query",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "CloudKit JS"
    ],
    "preciseIdentifier" : "struct/CloudKit.Query"
  },
  "title" : "CloudKit.Query"
}
-->

# CloudKit.Query

Search parameters to use when fetching records from the database.

```
dictionary CloudKit.Query {
	String recordType;
	Object[] filterBy;
	Object[] sortBy;
};
```

## Overview

The `CloudKit.Query` dictionary is the same as the dictionary described in [Fetching Records Using a Query (records/query)](https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/QueryingRecords.html#//apple_ref/doc/uid/TP40015240-CH5) in [CloudKit Web Services Reference](https://developer.apple.com/library/archive/documentation/DataManagement/Conceptual/CloudKitWebServicesReference/index.html#//apple_ref/doc/uid/TP40015240).

## Topics

### Instance Properties

[`attribute Object[] filterBy;`](/documentation/CloudKitJS/CloudKit.Query/filterBy)

An array of predicate dictionaries used to determine whether a record matches the query.

[`attribute String recordType;`](/documentation/CloudKitJS/CloudKit.Query/recordType)

The name of the record type. This key is required.

[`attribute Object[] sortBy;`](/documentation/CloudKitJS/CloudKit.Query/sortBy)

An array of sort descriptor dictionaries that specify how to order the fetched records.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)