> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UpdateDataCollection # Package: collectionManagement # Namespace: DataCollectionService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection.md ## Permission Scopes: Manage Data Collections: SCOPE.DC-DATA.DATA-COLLECTIONS-MANAGE ## Introduction Updates a data collection. A collection ID, revision number, permissions, and at least 1 field must be provided in the `collection` body parameter. If a collection with that ID exists, and if its current `revision` number matches the one provided, it's updated. Otherwise, the request fails.
Important: After a collection is updated, it only contains the properties included in the Update Data Collection request. If the existing collection has properties with values and those properties aren't included in the updated collection details, their values are lost.

To update only specific properties without affecting others, use [Patch Data Collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/patch-data-collection.md).
When a collection is updated, its `updatedDate` changes to the current date and its `revision` increments by 1. To update only properties in a collection's `fields` array, use [Update Data Collection Field](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection-field.md). To only add or remove `plugins`, use [Add Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/add-data-collection-plugin.md) or [Delete Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/delete-data-collection-plugin.md). --- ## REST API ### Schema ``` Method: updateDataCollection Description: Updates a data collection. A collection GUID, revision number, permissions, and at least 1 field must be provided in the `collection` body parameter. If a collection with that GUID exists, and if its current `revision` number matches the one provided, it's updated. Otherwise, the request fails.
Important: After a collection is updated, it only contains the properties included in the Update Data Collection request. If the existing collection has properties with values and those properties aren't included in the updated collection details, their values are lost.

To update only specific properties without affecting others, use [Patch Data Collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/patch-data-collection.md).
When a collection is updated, its `updatedDate` changes to the current date and its `revision` increments by 1. To update only properties in a collection's `fields` array, use [Update Data Collection Field](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection-field.md). To only add or remove `plugins`, use [Add Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/add-data-collection-plugin.md) or [Delete Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/delete-data-collection-plugin.md). URL: https://www.wixapis.com/wix-data/v2/collections Method: PUT # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: collection, collection.id, collection.fields.type, collection.fields.key, collection.permissions.insert, collection.permissions.update, collection.permissions.remove, collection.permissions.read, collection.revision Method parameters: param name: collection | type: DataCollection | description: A data collection determines the structure of data to be stored in a database. | required: true - name: id | type: string | description: [Collection GUID](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/work-with-data/introduction/about-collections.md#collection-ids). For example, `my-first-collection`. For [app collections](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/wix-app-collections/introduction.md), use `AppName/CollectionName`. | required: true - name: displayName | type: string | description: Collection's display name as shown in the CMS. For example, `My First Collection`. - name: displayField | type: string | description: Field whose value the CMS displays to represent the collection item when referenced in a different collection. - name: fields | type: array | description: Collection's field structure. - ONE-OF: - name: numberRange | type: NumberRange | description: Range of possible values for a numerical field. - name: min | type: number | description: Minimum permitted value for a numerical field. Default: No validation - name: max | type: number | description: Maximum permitted value for a numerical field. Default: No validation - name: stringLengthRange | type: StringLengthRange | description: Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. - name: minLength | type: integer | description: Minimum permitted length for a text field. Default: No validation - name: maxLength | type: integer | description: Maximum permitted length for a text field. Default: No validation - name: arraySizeRange | type: ArraySizeRange | description: Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. - name: minSize | type: integer | description: Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: maxSize | type: integer | description: Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: key | type: string | description: Unique identifier for the field. For example, `firstName`. - name: displayName | type: string | description: Field's display name when displayed in the CMS. For example, `First Name`. - name: type | type: Type | description: Field's data type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - enum: - TEXT: Plain-text string. - NUMBER: Number. - DATE: Date string in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DD`. - DATETIME: [JavaScript Date object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md)) or an object in the following format: `"someFieldKey": { "$date": "YYYY-MM-DDTHH:mm:ss.sssZ"}` ([REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md)). - IMAGE: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - BOOLEAN: Boolean `true` or `false` value. - DOCUMENT: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - URL: URL in one of the following formats: `http://`, `https://`, `ftp://`, `mailto:`, `sms:`, `tel:`. - RICH_TEXT: [Rich-text](https://dev.wix.com/docs/rest/articles/getting-started/rich-text.md) string that may contain a subset of HTML tags. - VIDEO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - ANY: Any field type. - ARRAY_STRING: Array of strings. - ARRAY_DOCUMENT: Array of documents: web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - AUDIO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - TIME: Time string in `hh:mm:ss.SSS` format. - LANGUAGE: Language codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. These may include country codes in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#officially_assigned_code_elements) format. - RICH_CONTENT: [Rich content](https://dev.wix.com/docs/ricos/getting-started/introduction.md). - MEDIA_GALLERY: Array of web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - ADDRESS: Physical address object ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md#address-object) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md#address-object)). - PAGE_LINK: [Dynamic page link](https://support.wix.com/en/article/cms-linking-to-dynamic-pages). - REFERENCE: Reference to another item in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. If you select this type, then you must pass the `referencedCollectionId` field as well. - MULTI_REFERENCE: References to multiple items in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. - OBJECT: JSON object. - ARRAY: Array. - LEGACY_TIME: Deprecated type that might appear in legacy collections. - LEGACY_BOOK: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_URL: Deprecated type that might appear in legacy collections. - LEGACY_BROKEN_REFERENCE: Deprecated type that might appear in legacy collections. - LEGACY_IMAGE: Deprecated type that might appear in legacy collections. - LEGACY_COLOR: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_VIDEO: Deprecated type that might appear in legacy collections. - EMAIL: Email. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - ONE-OF: - name: reference | type: Reference | description: Metadata for a reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: multiReference | type: MultiReference | description: Metadata for a multi-reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: referencingFieldKey | type: string | description: Referencing field GUID. - name: referencingDisplayName | type: string | description: Display name in the CMS for the referenced data. - name: object | type: Object | description: Metadata for an object field. - name: fields | type: array | description: Fields within the object. - name: key | type: string | description: Field GUID. - name: displayName | type: string | description: Display name for the field. - name: type | type: Type | description: Field type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: array | type: Array | description: Metadata for an array field. - name: elementType | type: Type | description: Element's data type. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: pageLink | type: PageLink | description: Metadata for a page link field. - name: calculator | type: Calculator | description: - ONE-OF: - name: fieldsPattern | type: FieldsPattern | description: Value is calculated according to pattern, whitespaces are replaced with dash [-]. - name: pattern | type: string | description: - name: lowercase | type: boolean | description: - name: urlizedOnlyPattern | type: UrlizedOnlyPattern | description: Value is only URL encoded. - name: pattern | type: string | description: - name: linkedRouterPage | type: string | description: Defines reference to router pattern in the site document. - name: encrypted | type: boolean | description: Whether the field is encrypted. - name: description | type: string | description: Field description. - name: readOnly | type: boolean | description: Whether the field is read-only. A read-only field can't be changed. Default: `false` - name: immutable | type: boolean | description: Whether the field is immutable. An immutable field can be set once, but then cannot be updated. Default: `false` - name: required | type: boolean | description: Whether the field is required. Default: `false` - name: plugins | type: array | description: Additional optional plugins for the field. - ONE-OF: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: internal | type: boolean | description: Indicates an internal CMS field. The CMS does not display internal fields. Default: `false` - name: categoryFieldOptions | type: CategoryFieldOptions | description: Options for the CATEGORY_FIELD plugin. - name: isPrimary | type: boolean | description: Transient input-only flag. When set to `true` during create/update, designates this category field's group as the target for `_primaryCategory`. The flag is not persisted; `_primaryCategory` remains the source of truth. Default: `false` - name: type | type: Type | description: - enum: - UNKNOWN: Uknown plugin type. - CMS: CMS-related field attributes - name: permissions | type: Permissions | description: [Permissions](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md#permissions) required to access and modify collection items, defined by the lowest role needed to perform each action. - name: insert | type: Role | description: Role required to insert items into the collection. Default: `CMS_EDITOR` | required: true - enum: - ADMIN: Site administrator. - SITE_MEMBER_AUTHOR: Signed-in user who added content to this collection. - SITE_MEMBER: Any signed-in user. - ANYONE: Any site visitor. - name: update | type: Role | description: Role required to update collection items. Default: `CMS_EDITOR` | required: true - name: remove | type: Role | description: Role required to remove items from the collection. Default: `CMS_EDITOR` | required: true - name: read | type: Role | description: Role required to read collection items. Default: `SITE_MEMBER_AUTHOR` | required: true - name: revision | type: string | description: Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must specify the latest revision number. | required: true - name: plugins | type: array | description: Plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. - ONE-OF: - name: publishOptions | type: PublishPluginOptions | description: Options for the Publish plugin. This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object.md) to be marked as draft or published. Published items are visible to site visitors, while draft items are not. - name: defaultStatus | type: Status | description: Default status. - enum: PUBLISHED, DRAFT - name: singleItemOptions | type: SingleItemPluginOptions | description: Options for the Single Item plugin. - name: singleItemId | type: string | description: GUID of the single item in this collection. If you insert or update an item, its GUID value is always changed to this. - name: urlizedOptions | type: UrlizedPluginOptions | description: Options for the Urlized plugin. - name: format | type: Format | description: Encoding method for generating a URL in ASCII characters. - enum: - ORIGINAL: Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. - PLAIN: No changes are made before generating the encoded URL. - name: multilingualOptions | type: MultilingualOptions | description: Options for the Multilingual plugin. - name: translatableFieldKeys | type: array | description: IDs of fields to allow translation. - name: editablePageLinkOptions | type: PageLinkPluginOptions | description: Options for the PageLink plugin. - name: isPersisted | type: boolean | description: - name: isMutable | type: boolean | description: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: siteSort | type: SiteSort | description: CMS sort, applied when a collection is displayed on a site. - name: sort | type: array | description: Field and order for the site sort. - name: fieldKey | type: string | description: Field to sort by. - name: direction | type: Direction | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order. Default: `ASC` - enum: ASC, DESC - name: type | type: Type | description: Plugin type. - enum: - PUBLISH: Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. - SINGLE_ITEM: Ensures the collection can have one item at most. Can only be applied to a new collection. - URLIZED: Generates item URLs for collections used by dynamic pages. - GRIDAPPLESS: Deprecated. Will be removed in the future. - MULTILINGUAL: Indicates that the collection is translatable. This allows you to manage translation for selected fields using [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - SHARED: Indicates that collection is shared with current site. - EDITABLE_PAGE_LINK: Indicates that page link fields are persisted and can be updated. - CMS: CMS-specific collection properties. Return type: UpdateDataCollectionResponse - name: collection | type: DataCollection | description: Updated collection details. - name: id | type: string | description: [Collection GUID](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/work-with-data/introduction/about-collections.md#collection-ids). For example, `my-first-collection`. For [app collections](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/wix-app-collections/introduction.md), use `AppName/CollectionName`. - name: collectionType | type: CollectionType | description: Collection type. Indicates how the collection was created and how it is stored. - enum: - NATIVE: User-created collection. - WIX_APP: [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). - BLOCKS_APP: Collection created by a Wix Blocks app. - EXTERNAL: Collection located in externally connected storage. - name: ownerAppId | type: string | description: GUID of the app that defined this collection. For collections defined by Wix users, this value is null. - name: maxPageSize | type: integer | description: Maximum number of items returned in a single query, based on the underlying storage. Native collections have a maximum page size of 1000 for offset-based queries or 100 for cursor-based queries. External collections' maximum page size defaults to 50, but an external provider can set any maximum value up to 1000. - name: displayName | type: string | description: Collection's display name as shown in the CMS. For example, `My First Collection`. - name: defaultDisplayOrder | type: Sort | description: Default item sorting order when a query doesn't specify one. - name: fieldKey | type: string | description: Field to sort by. - name: direction | type: Direction | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order. Default: `ASC` - enum: ASC, DESC - name: displayNamespace | type: string | description: UI-friendly namespace of the Wix app with which the data collection is associated, such as Stores or Bookings. Empty for all data collections not owned by Wix apps. - name: displayField | type: string | description: Field whose value the CMS displays to represent the collection item when referenced in a different collection. - name: capabilities | type: CollectionCapabilities | description: Capabilities the collection supports. Capabilities are set by default. Values depend on the collection type. - name: dataOperations | type: array | description: Data operations the collection supports. The listed operations can be performed on data the collection contains. > **Note**: The `PATCH` and `BULK_PATCH` operations aren't currently supported. - enum: AGGREGATE, BULK_INSERT, BULK_REMOVE, BULK_SAVE, BULK_UPDATE, COUNT, DISTINCT, FIND, GET, INSERT, INSERT_REFERENCE, IS_REFERENCED, QUERY_REFERENCED, REMOVE, REMOVE_REFERENCE, REPLACE_REFERENCES, SAVE, TRUNCATE, UPDATE, PATCH, BULK_PATCH - name: collectionOperations | type: array | description: Collection operations supported. The listed operations can be performed on the collection itself. - enum: - UPDATE: Allows updating the collection's structure, for example adding, updating, or deleting fields. If not included, the collection's structure can't be changed. - REMOVE: Allows deleting the entire collection. If not included, the collection can't be deleted. - name: indexLimits | type: IndexLimits | description: Maximum number of indexes for the collection. - name: regular | type: integer | description: Maximum number of regular (non-unique) indexes allowed for this collection. - name: unique | type: integer | description: Maximum number of unique indexes allowed for this collection. - name: total | type: integer | description: Maximum number of regular and unique indexes allowed for this collection. - name: fields | type: array | description: Collection's field structure. - ONE-OF: - name: numberRange | type: NumberRange | description: Range of possible values for a numerical field. - name: min | type: number | description: Minimum permitted value for a numerical field. Default: No validation - name: max | type: number | description: Maximum permitted value for a numerical field. Default: No validation - name: stringLengthRange | type: StringLengthRange | description: Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. - name: minLength | type: integer | description: Minimum permitted length for a text field. Default: No validation - name: maxLength | type: integer | description: Maximum permitted length for a text field. Default: No validation - name: arraySizeRange | type: ArraySizeRange | description: Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. - name: minSize | type: integer | description: Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: maxSize | type: integer | description: Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: key | type: string | description: Unique identifier for the field. For example, `firstName`. - name: displayName | type: string | description: Field's display name when displayed in the CMS. For example, `First Name`. - name: type | type: Type | description: Field's data type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - enum: - TEXT: Plain-text string. - NUMBER: Number. - DATE: Date string in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DD`. - DATETIME: [JavaScript Date object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md)) or an object in the following format: `"someFieldKey": { "$date": "YYYY-MM-DDTHH:mm:ss.sssZ"}` ([REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md)). - IMAGE: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - BOOLEAN: Boolean `true` or `false` value. - DOCUMENT: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - URL: URL in one of the following formats: `http://`, `https://`, `ftp://`, `mailto:`, `sms:`, `tel:`. - RICH_TEXT: [Rich-text](https://dev.wix.com/docs/rest/articles/getting-started/rich-text.md) string that may contain a subset of HTML tags. - VIDEO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - ANY: Any field type. - ARRAY_STRING: Array of strings. - ARRAY_DOCUMENT: Array of documents: web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - AUDIO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - TIME: Time string in `hh:mm:ss.SSS` format. - LANGUAGE: Language codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. These may include country codes in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#officially_assigned_code_elements) format. - RICH_CONTENT: [Rich content](https://dev.wix.com/docs/ricos/getting-started/introduction.md). - MEDIA_GALLERY: Array of web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - ADDRESS: Physical address object ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md#address-object) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md#address-object)). - PAGE_LINK: [Dynamic page link](https://support.wix.com/en/article/cms-linking-to-dynamic-pages). - REFERENCE: Reference to another item in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. If you select this type, then you must pass the `referencedCollectionId` field as well. - MULTI_REFERENCE: References to multiple items in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. - OBJECT: JSON object. - ARRAY: Array. - LEGACY_TIME: Deprecated type that might appear in legacy collections. - LEGACY_BOOK: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_URL: Deprecated type that might appear in legacy collections. - LEGACY_BROKEN_REFERENCE: Deprecated type that might appear in legacy collections. - LEGACY_IMAGE: Deprecated type that might appear in legacy collections. - LEGACY_COLOR: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_VIDEO: Deprecated type that might appear in legacy collections. - EMAIL: Email. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - ONE-OF: - name: reference | type: Reference | description: Metadata for a reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: multiReference | type: MultiReference | description: Metadata for a multi-reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: referencingFieldKey | type: string | description: Referencing field GUID. - name: referencingDisplayName | type: string | description: Display name in the CMS for the referenced data. - name: object | type: Object | description: Metadata for an object field. - name: fields | type: array | description: Fields within the object. - name: key | type: string | description: Field GUID. - name: displayName | type: string | description: Display name for the field. - name: type | type: Type | description: Field type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: capabilities | type: FieldCapabilities | description: Capabilities the object field supports. - name: sortable | type: boolean | description: Whether the collection can be sorted by this field. Default: `false` - name: queryOperators | type: array | description: Query operators that can be used for this field. - enum: EQ, LT, GT, NE, LTE, GTE, STARTS_WITH, ENDS_WITH, CONTAINS, HAS_SOME, HAS_ALL, EXISTS, URLIZED - name: array | type: Array | description: Metadata for an array field. - name: elementType | type: Type | description: Element's data type. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: pageLink | type: PageLink | description: Metadata for a page link field. - name: calculator | type: Calculator | description: - ONE-OF: - name: fieldsPattern | type: FieldsPattern | description: Value is calculated according to pattern, whitespaces are replaced with dash [-]. - name: pattern | type: string | description: - name: lowercase | type: boolean | description: - name: urlizedOnlyPattern | type: UrlizedOnlyPattern | description: Value is only URL encoded. - name: pattern | type: string | description: - name: linkedRouterPage | type: string | description: Defines reference to router pattern in the site document. - name: systemField | type: boolean | description: Whether the field is a system field. - name: capabilities | type: FieldCapabilities | description: Capabilities the field supports. - name: encrypted | type: boolean | description: Whether the field is encrypted. - name: description | type: string | description: Field description. - name: readOnly | type: boolean | description: Whether the field is read-only. A read-only field can't be changed. Default: `false` - name: immutable | type: boolean | description: Whether the field is immutable. An immutable field can be set once, but then cannot be updated. Default: `false` - name: required | type: boolean | description: Whether the field is required. Default: `false` - name: plugins | type: array | description: Additional optional plugins for the field. - ONE-OF: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: internal | type: boolean | description: Indicates an internal CMS field. The CMS does not display internal fields. Default: `false` - name: categoryFieldOptions | type: CategoryFieldOptions | description: Options for the CATEGORY_FIELD plugin. - name: isPrimary | type: boolean | description: Transient input-only flag. When set to `true` during create/update, designates this category field's group as the target for `_primaryCategory`. The flag is not persisted; `_primaryCategory` remains the source of truth. Default: `false` - name: type | type: Type | description: - enum: - UNKNOWN: Uknown plugin type. - CMS: CMS-related field attributes - name: condition | type: FieldCondition | description: This indicates that this fields is conditional and is not retrieved by default. - name: groupName | type: string | description: If `group_name` is set, this field will not be present in query results. To retrieve this field, pass `group_name` value to `includeFieldGroups` parameter in query operations. - name: permission | type: Permission | description: If present, the field may be omitted from the results, if the requester lacks sufficient permissions to access data stored in the field. - enum: - ANYONE: Any role can request the field. - RESTRICTED: Special permission required to request the field. - name: permissions | type: Permissions | description: [Permissions](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md#permissions) required to access and modify collection items, defined by the lowest role needed to perform each action. - name: insert | type: Role | description: Role required to insert items into the collection. Default: `CMS_EDITOR` - enum: - ADMIN: Site administrator. - SITE_MEMBER_AUTHOR: Signed-in user who added content to this collection. - SITE_MEMBER: Any signed-in user. - ANYONE: Any site visitor. - name: update | type: Role | description: Role required to update collection items. Default: `CMS_EDITOR` - name: remove | type: Role | description: Role required to remove items from the collection. Default: `CMS_EDITOR` - name: read | type: Role | description: Role required to read collection items. Default: `SITE_MEMBER_AUTHOR` - name: revision | type: string | description: Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must specify the latest revision number. - name: plugins | type: array | description: Plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. - ONE-OF: - name: publishOptions | type: PublishPluginOptions | description: Options for the Publish plugin. This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object.md) to be marked as draft or published. Published items are visible to site visitors, while draft items are not. - name: defaultStatus | type: Status | description: Default status. - enum: PUBLISHED, DRAFT - name: singleItemOptions | type: SingleItemPluginOptions | description: Options for the Single Item plugin. - name: singleItemId | type: string | description: GUID of the single item in this collection. If you insert or update an item, its GUID value is always changed to this. - name: urlizedOptions | type: UrlizedPluginOptions | description: Options for the Urlized plugin. - name: format | type: Format | description: Encoding method for generating a URL in ASCII characters. - enum: - ORIGINAL: Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. - PLAIN: No changes are made before generating the encoded URL. - name: multilingualOptions | type: MultilingualOptions | description: Options for the Multilingual plugin. - name: translatableFieldKeys | type: array | description: IDs of fields to allow translation. - name: editablePageLinkOptions | type: PageLinkPluginOptions | description: Options for the PageLink plugin. - name: isPersisted | type: boolean | description: - name: isMutable | type: boolean | description: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: siteSort | type: SiteSort | description: CMS sort, applied when a collection is displayed on a site. - name: sort | type: array | description: Field and order for the site sort. - name: type | type: Type | description: Plugin type. - enum: - PUBLISH: Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. - SINGLE_ITEM: Ensures the collection can have one item at most. Can only be applied to a new collection. - URLIZED: Generates item URLs for collections used by dynamic pages. - GRIDAPPLESS: Deprecated. Will be removed in the future. - MULTILINGUAL: Indicates that the collection is translatable. This allows you to manage translation for selected fields using [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - SHARED: Indicates that collection is shared with current site. - EDITABLE_PAGE_LINK: Indicates that page link fields are persisted and can be updated. - CMS: CMS-specific collection properties. - name: pagingModes | type: array | description: Paging modes the collection supports. In native collections, offset-based paging is supported by default. - enum: - OFFSET: Offset-based paging. - CURSOR: Cursor-based paging. - name: createdDate | type: string | description: Date the collection was created. - name: updatedDate | type: string | description: Date the collection was last updated. ``` ### Examples ### Update a collection ```curl curl -X PUT \ 'https://www.wixapis.com/wix-data/v2/collections' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "collection": { "id": "my-first-collection", "revision": "1", "displayName": "Author Collection", "fields": [ {"key": "first_name", "displayName": "First Name", "type": "TEXT"}, {"key": "last_name", "displayName": "Last Name", "type": "TEXT"} ], "permissions": { "insert": "ADMIN", "update": "ADMIN", "remove": "ADMIN", "read": "ANYONE" } } }' ``` ### Update a collection (example containing an array data field) ```curl curl -X PUT \ 'https://www.wixapis.com/wix-data/v2/collections' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "collection": { "id": "my-first-collection", "revision": "1", "displayName": "Author Collection", "fields": [ { "key": "first_name", "displayName": "First Name", "type": "TEXT" }, { "key": "last_name", "displayName": "Last Name", "type": "TEXT" }, { "key": "books", "displayName": "Books", "type": "ARRAY", "typeMetadata": { "array": { "elementType": "TEXT" } } } ], "permissions": { "insert": "ADMIN", "update": "ADMIN", "remove": "ADMIN", "read": "ANYONE" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.collectionManagement.DataCollectionService.updateDataCollection(collection) Description: Updates a data collection. A collection GUID, revision number, permissions, and at least 1 field must be provided in the `collection` body parameter. If a collection with that GUID exists, and if its current `revision` number matches the one provided, it's updated. Otherwise, the request fails.
Important: After a collection is updated, it only contains the properties included in the Update Data Collection request. If the existing collection has properties with values and those properties aren't included in the updated collection details, their values are lost.

To update only specific properties without affecting others, use [Patch Data Collection](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/patch-data-collection.md).
When a collection is updated, its `updatedDate` changes to the current date and its `revision` increments by 1. To update only properties in a collection's `fields` array, use [Update Data Collection Field](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/update-data-collection-field.md). To only add or remove `plugins`, use [Add Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/add-data-collection-plugin.md) or [Delete Data Collection Plugin](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/delete-data-collection-plugin.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: collection, collection._id, collection.fields.type, collection.fields.key, collection.permissions.insert, collection.permissions.update, collection.permissions.remove, collection.permissions.read, collection.revision Method parameters: param name: collection | type: DataCollection | description: A data collection determines the structure of data to be stored in a database. | required: true - name: _id | type: string | description: [Collection GUID](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/work-with-data/introduction/about-collections.md#collection-ids). For example, `my-first-collection`. For [app collections](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/wix-app-collections/introduction.md), use `AppName/CollectionName`. | required: true - name: displayName | type: string | description: Collection's display name as shown in the CMS. For example, `My First Collection`. - name: displayField | type: string | description: Field whose value the CMS displays to represent the collection item when referenced in a different collection. - name: fields | type: array | description: Collection's field structure. - ONE-OF: - name: numberRange | type: NumberRange | description: Range of possible values for a numerical field. - name: min | type: number | description: Minimum permitted value for a numerical field. Default: No validation - name: max | type: number | description: Maximum permitted value for a numerical field. Default: No validation - name: stringLengthRange | type: StringLengthRange | description: Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. - name: minLength | type: integer | description: Minimum permitted length for a text field. Default: No validation - name: maxLength | type: integer | description: Maximum permitted length for a text field. Default: No validation - name: arraySizeRange | type: ArraySizeRange | description: Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. - name: minSize | type: integer | description: Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: maxSize | type: integer | description: Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: key | type: string | description: Unique identifier for the field. For example, `firstName`. - name: displayName | type: string | description: Field's display name when displayed in the CMS. For example, `First Name`. - name: type | type: Type | description: Field's data type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - enum: - TEXT: Plain-text string. - NUMBER: Number. - DATE: Date string in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DD`. - DATETIME: [JavaScript Date object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md)) or an object in the following format: `"someFieldKey": { "$date": "YYYY-MM-DDTHH:mm:ss.sssZ"}` ([REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md)). - IMAGE: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - BOOLEAN: Boolean `true` or `false` value. - DOCUMENT: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - URL: URL in one of the following formats: `http://`, `https://`, `ftp://`, `mailto:`, `sms:`, `tel:`. - RICH_TEXT: [Rich-text](https://dev.wix.com/docs/rest/articles/getting-started/rich-text.md) string that may contain a subset of HTML tags. - VIDEO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - ANY: Any field type. - ARRAY_STRING: Array of strings. - ARRAY_DOCUMENT: Array of documents: web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - AUDIO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - TIME: Time string in `hh:mm:ss.SSS` format. - LANGUAGE: Language codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. These may include country codes in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#officially_assigned_code_elements) format. - RICH_CONTENT: [Rich content](https://dev.wix.com/docs/ricos/getting-started/introduction.md). - MEDIA_GALLERY: Array of web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - ADDRESS: Physical address object ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md#address-object) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md#address-object)). - PAGE_LINK: [Dynamic page link](https://support.wix.com/en/article/cms-linking-to-dynamic-pages). - REFERENCE: Reference to another item in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. If you select this type, then you must pass the `referencedCollectionId` field as well. - MULTI_REFERENCE: References to multiple items in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. - OBJECT: JSON object. - ARRAY: Array. - LEGACY_TIME: Deprecated type that might appear in legacy collections. - LEGACY_BOOK: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_URL: Deprecated type that might appear in legacy collections. - LEGACY_BROKEN_REFERENCE: Deprecated type that might appear in legacy collections. - LEGACY_IMAGE: Deprecated type that might appear in legacy collections. - LEGACY_COLOR: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_VIDEO: Deprecated type that might appear in legacy collections. - EMAIL: Email. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - ONE-OF: - name: reference | type: Reference | description: Metadata for a reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: multiReference | type: MultiReference | description: Metadata for a multi-reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: referencingFieldKey | type: string | description: Referencing field GUID. - name: referencingDisplayName | type: string | description: Display name in the CMS for the referenced data. - name: object | type: Object | description: Metadata for an object field. - name: fields | type: array | description: Fields within the object. - name: key | type: string | description: Field GUID. - name: displayName | type: string | description: Display name for the field. - name: type | type: Type | description: Field type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: array | type: Array | description: Metadata for an array field. - name: elementType | type: Type | description: Element's data type. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: pageLink | type: PageLink | description: Metadata for a page link field. - name: calculator | type: Calculator | description: - ONE-OF: - name: fieldsPattern | type: FieldsPattern | description: Value is calculated according to pattern, whitespaces are replaced with dash [-]. - name: pattern | type: string | description: - name: lowercase | type: boolean | description: - name: urlizedOnlyPattern | type: UrlizedOnlyPattern | description: Value is only URL encoded. - name: pattern | type: string | description: - name: linkedRouterPage | type: string | description: Defines reference to router pattern in the site document. - name: encrypted | type: boolean | description: Whether the field is encrypted. - name: description | type: string | description: Field description. - name: readOnly | type: boolean | description: Whether the field is read-only. A read-only field can't be changed. Default: `false` - name: immutable | type: boolean | description: Whether the field is immutable. An immutable field can be set once, but then cannot be updated. Default: `false` - name: required | type: boolean | description: Whether the field is required. Default: `false` - name: plugins | type: array | description: Additional optional plugins for the field. - ONE-OF: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: internal | type: boolean | description: Indicates an internal CMS field. The CMS does not display internal fields. Default: `false` - name: categoryFieldOptions | type: CategoryFieldOptions | description: Options for the CATEGORY_FIELD plugin. - name: isPrimary | type: boolean | description: Transient input-only flag. When set to `true` during create/update, designates this category field's group as the target for `_primaryCategory`. The flag is not persisted; `_primaryCategory` remains the source of truth. Default: `false` - name: type | type: Type | description: - enum: - UNKNOWN: Uknown plugin type. - CMS: CMS-related field attributes - name: permissions | type: Permissions | description: [Permissions](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md#permissions) required to access and modify collection items, defined by the lowest role needed to perform each action. - name: insert | type: Role | description: Role required to insert items into the collection. Default: `CMS_EDITOR` | required: true - enum: - ADMIN: Site administrator. - SITE_MEMBER_AUTHOR: Signed-in user who added content to this collection. - SITE_MEMBER: Any signed-in user. - ANYONE: Any site visitor. - name: update | type: Role | description: Role required to update collection items. Default: `CMS_EDITOR` | required: true - name: remove | type: Role | description: Role required to remove items from the collection. Default: `CMS_EDITOR` | required: true - name: read | type: Role | description: Role required to read collection items. Default: `SITE_MEMBER_AUTHOR` | required: true - name: revision | type: string | description: Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must specify the latest revision number. | required: true - name: plugins | type: array | description: Plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. - ONE-OF: - name: publishOptions | type: PublishPluginOptions | description: Options for the Publish plugin. This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object.md) to be marked as draft or published. Published items are visible to site visitors, while draft items are not. - name: defaultStatus | type: Status | description: Default status. - enum: PUBLISHED, DRAFT - name: singleItemOptions | type: SingleItemPluginOptions | description: Options for the Single Item plugin. - name: singleItemId | type: string | description: GUID of the single item in this collection. If you insert or update an item, its GUID value is always changed to this. - name: urlizedOptions | type: UrlizedPluginOptions | description: Options for the Urlized plugin. - name: format | type: Format | description: Encoding method for generating a URL in ASCII characters. - enum: - ORIGINAL: Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. - PLAIN: No changes are made before generating the encoded URL. - name: multilingualOptions | type: MultilingualOptions | description: Options for the Multilingual plugin. - name: translatableFieldKeys | type: array | description: IDs of fields to allow translation. - name: editablePageLinkOptions | type: PageLinkPluginOptions | description: Options for the PageLink plugin. - name: isPersisted | type: boolean | description: - name: isMutable | type: boolean | description: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: siteSort | type: SiteSort | description: CMS sort, applied when a collection is displayed on a site. - name: sort | type: array | description: Field and order for the site sort. - name: fieldKey | type: string | description: Field to sort by. - name: direction | type: Direction | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order. Default: `ASC` - enum: ASC, DESC - name: type | type: Type | description: Plugin type. - enum: - PUBLISH: Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. - SINGLE_ITEM: Ensures the collection can have one item at most. Can only be applied to a new collection. - URLIZED: Generates item URLs for collections used by dynamic pages. - GRIDAPPLESS: Deprecated. Will be removed in the future. - MULTILINGUAL: Indicates that the collection is translatable. This allows you to manage translation for selected fields using [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - SHARED: Indicates that collection is shared with current site. - EDITABLE_PAGE_LINK: Indicates that page link fields are persisted and can be updated. - CMS: CMS-specific collection properties. Return type: PROMISE - name: _id | type: string | description: [Collection GUID](https://dev.wix.com/docs/develop-websites-sdk/code-your-site/work-with-data/introduction/about-collections.md#collection-ids). For example, `my-first-collection`. For [app collections](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/wix-app-collections/introduction.md), use `AppName/CollectionName`. - name: collectionType | type: CollectionType | description: Collection type. Indicates how the collection was created and how it is stored. - enum: - NATIVE: User-created collection. - WIX_APP: [Collection](https://support.wix.com/en/article/velo-working-with-wix-app-collections-and-code#what-are-wix-app-collections) created by a Wix app when it is installed. This type of collection can be modified dynamically by that app (for example, Wix Forms). - BLOCKS_APP: Collection created by a Wix Blocks app. - EXTERNAL: Collection located in externally connected storage. - name: ownerAppId | type: string | description: GUID of the app that defined this collection. For collections defined by Wix users, this value is null. - name: maxPageSize | type: integer | description: Maximum number of items returned in a single query, based on the underlying storage. Native collections have a maximum page size of 1000 for offset-based queries or 100 for cursor-based queries. External collections' maximum page size defaults to 50, but an external provider can set any maximum value up to 1000. - name: displayName | type: string | description: Collection's display name as shown in the CMS. For example, `My First Collection`. - name: defaultDisplayOrder | type: Sort | description: Default item sorting order when a query doesn't specify one. - name: fieldKey | type: string | description: Field to sort by. - name: direction | type: Direction | description: Sort order. Use `ASC` for ascending order or `DESC` for descending order. Default: `ASC` - enum: ASC, DESC - name: displayNamespace | type: string | description: UI-friendly namespace of the Wix app with which the data collection is associated, such as Stores or Bookings. Empty for all data collections not owned by Wix apps. - name: displayField | type: string | description: Field whose value the CMS displays to represent the collection item when referenced in a different collection. - name: capabilities | type: CollectionCapabilities | description: Capabilities the collection supports. Capabilities are set by default. Values depend on the collection type. - name: dataOperations | type: array | description: Data operations the collection supports. The listed operations can be performed on data the collection contains. > **Note**: The `PATCH` and `BULK_PATCH` operations aren't currently supported. - enum: AGGREGATE, BULK_INSERT, BULK_REMOVE, BULK_SAVE, BULK_UPDATE, COUNT, DISTINCT, FIND, GET, INSERT, INSERT_REFERENCE, IS_REFERENCED, QUERY_REFERENCED, REMOVE, REMOVE_REFERENCE, REPLACE_REFERENCES, SAVE, TRUNCATE, UPDATE, PATCH, BULK_PATCH - name: collectionOperations | type: array | description: Collection operations supported. The listed operations can be performed on the collection itself. - enum: - UPDATE: Allows updating the collection's structure, for example adding, updating, or deleting fields. If not included, the collection's structure can't be changed. - REMOVE: Allows deleting the entire collection. If not included, the collection can't be deleted. - name: indexLimits | type: IndexLimits | description: Maximum number of indexes for the collection. - name: regular | type: integer | description: Maximum number of regular (non-unique) indexes allowed for this collection. - name: unique | type: integer | description: Maximum number of unique indexes allowed for this collection. - name: total | type: integer | description: Maximum number of regular and unique indexes allowed for this collection. - name: fields | type: array | description: Collection's field structure. - ONE-OF: - name: numberRange | type: NumberRange | description: Range of possible values for a numerical field. - name: min | type: number | description: Minimum permitted value for a numerical field. Default: No validation - name: max | type: number | description: Maximum permitted value for a numerical field. Default: No validation - name: stringLengthRange | type: StringLengthRange | description: Length range permitted for a text field. Relevant for fields that hold strings, such as those of type `TEXT` or `RICH_TEXT`. - name: minLength | type: integer | description: Minimum permitted length for a text field. Default: No validation - name: maxLength | type: integer | description: Maximum permitted length for a text field. Default: No validation - name: arraySizeRange | type: ArraySizeRange | description: Array size range permitted. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. - name: minSize | type: integer | description: Minimum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: maxSize | type: integer | description: Maximum permitted number of items in an array field. Relevant for fields that hold arrays, such as those of type `ARRAY`, `ARRAY_STRING`, or `ARRAY_DOCUMENT`. Default: No validation - name: key | type: string | description: Unique identifier for the field. For example, `firstName`. - name: displayName | type: string | description: Field's display name when displayed in the CMS. For example, `First Name`. - name: type | type: Type | description: Field's data type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - enum: - TEXT: Plain-text string. - NUMBER: Number. - DATE: Date string in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DD`. - DATETIME: [JavaScript Date object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md)) or an object in the following format: `"someFieldKey": { "$date": "YYYY-MM-DDTHH:mm:ss.sssZ"}` ([REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md)). - IMAGE: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - BOOLEAN: Boolean `true` or `false` value. - DOCUMENT: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - URL: URL in one of the following formats: `http://`, `https://`, `ftp://`, `mailto:`, `sms:`, `tel:`. - RICH_TEXT: [Rich-text](https://dev.wix.com/docs/rest/articles/getting-started/rich-text.md) string that may contain a subset of HTML tags. - VIDEO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - ANY: Any field type. - ARRAY_STRING: Array of strings. - ARRAY_DOCUMENT: Array of documents: web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - AUDIO: Web URL or a [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URL. - TIME: Time string in `hh:mm:ss.SSS` format. - LANGUAGE: Language codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. These may include country codes in [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#officially_assigned_code_elements) format. - RICH_CONTENT: [Rich content](https://dev.wix.com/docs/ricos/getting-started/introduction.md). - MEDIA_GALLERY: Array of web or [Media Manager](https://dev.wix.com/docs/rest/assets/media/media-manager/introduction.md) URLs. - ADDRESS: Physical address object ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/data-types-in-wix-data.md#address-object) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md#address-object)). - PAGE_LINK: [Dynamic page link](https://support.wix.com/en/article/cms-linking-to-dynamic-pages). - REFERENCE: Reference to another item in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. If you select this type, then you must pass the `referencedCollectionId` field as well. - MULTI_REFERENCE: References to multiple items in another collection. See Query Referenced Data Items ([SDK](https://dev.wix.com/docs/sdk/backend-modules/data/items/query-referenced.md) | [REST](https://dev.wix.com/docs/rest/business-solutions/cms/data-items/query-referenced-data-items.md)) to learn about item references. - OBJECT: JSON object. - ARRAY: Array. - LEGACY_TIME: Deprecated type that might appear in legacy collections. - LEGACY_BOOK: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_URL: Deprecated type that might appear in legacy collections. - LEGACY_BROKEN_REFERENCE: Deprecated type that might appear in legacy collections. - LEGACY_IMAGE: Deprecated type that might appear in legacy collections. - LEGACY_COLOR: Deprecated type that might appear in legacy collections. - LEGACY_EXTERNAL_VIDEO: Deprecated type that might appear in legacy collections. - EMAIL: Email. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - ONE-OF: - name: reference | type: Reference | description: Metadata for a reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: multiReference | type: MultiReference | description: Metadata for a multi-reference field. - name: referencedCollectionId | type: string | description: Referenced collection GUID. - name: referencingFieldKey | type: string | description: Referencing field GUID. - name: referencingDisplayName | type: string | description: Display name in the CMS for the referenced data. - name: object | type: Object | description: Metadata for an object field. - name: fields | type: array | description: Fields within the object. - name: key | type: string | description: Field GUID. - name: displayName | type: string | description: Display name for the field. - name: type | type: Type | description: Field type. Learn more about [data types in Wix Data](https://dev.wix.com/docs/rest/business-solutions/cms/data-types-in-wix-data.md). - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: capabilities | type: FieldCapabilities | description: Capabilities the object field supports. - name: sortable | type: boolean | description: Whether the collection can be sorted by this field. Default: `false` - name: queryOperators | type: array | description: Query operators that can be used for this field. - enum: EQ, LT, GT, NE, LTE, GTE, STARTS_WITH, ENDS_WITH, CONTAINS, HAS_SOME, HAS_ALL, EXISTS, URLIZED - name: array | type: Array | description: Metadata for an array field. - name: elementType | type: Type | description: Element's data type. - name: typeMetadata | type: TypeMetadata | description: Metadata for complex data types. This property only exists for references, multi-references, objects, and arrays. - name: pageLink | type: PageLink | description: Metadata for a page link field. - name: calculator | type: Calculator | description: - ONE-OF: - name: fieldsPattern | type: FieldsPattern | description: Value is calculated according to pattern, whitespaces are replaced with dash [-]. - name: pattern | type: string | description: - name: lowercase | type: boolean | description: - name: urlizedOnlyPattern | type: UrlizedOnlyPattern | description: Value is only URL encoded. - name: pattern | type: string | description: - name: linkedRouterPage | type: string | description: Defines reference to router pattern in the site document. - name: systemField | type: boolean | description: Whether the field is a system field. - name: capabilities | type: FieldCapabilities | description: Capabilities the field supports. - name: encrypted | type: boolean | description: Whether the field is encrypted. - name: description | type: string | description: Field description. - name: readOnly | type: boolean | description: Whether the field is read-only. A read-only field can't be changed. Default: `false` - name: immutable | type: boolean | description: Whether the field is immutable. An immutable field can be set once, but then cannot be updated. Default: `false` - name: required | type: boolean | description: Whether the field is required. Default: `false` - name: plugins | type: array | description: Additional optional plugins for the field. - ONE-OF: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: internal | type: boolean | description: Indicates an internal CMS field. The CMS does not display internal fields. Default: `false` - name: categoryFieldOptions | type: CategoryFieldOptions | description: Options for the CATEGORY_FIELD plugin. - name: isPrimary | type: boolean | description: Transient input-only flag. When set to `true` during create/update, designates this category field's group as the target for `_primaryCategory`. The flag is not persisted; `_primaryCategory` remains the source of truth. Default: `false` - name: type | type: Type | description: - enum: - UNKNOWN: Uknown plugin type. - CMS: CMS-related field attributes - name: condition | type: FieldCondition | description: This indicates that this fields is conditional and is not retrieved by default. - name: groupName | type: string | description: If `group_name` is set, this field will not be present in query results. To retrieve this field, pass `group_name` value to `includeFieldGroups` parameter in query operations. - name: permission | type: Permission | description: If present, the field may be omitted from the results, if the requester lacks sufficient permissions to access data stored in the field. - enum: - ANYONE: Any role can request the field. - RESTRICTED: Special permission required to request the field. - name: permissions | type: Permissions | description: [Permissions](https://dev.wix.com/docs/api-reference/business-solutions/cms/collection-management/data-collections/introduction.md#permissions) required to access and modify collection items, defined by the lowest role needed to perform each action. - name: insert | type: Role | description: Role required to insert items into the collection. Default: `CMS_EDITOR` - enum: - ADMIN: Site administrator. - SITE_MEMBER_AUTHOR: Signed-in user who added content to this collection. - SITE_MEMBER: Any signed-in user. - ANYONE: Any site visitor. - name: update | type: Role | description: Role required to update collection items. Default: `CMS_EDITOR` - name: remove | type: Role | description: Role required to remove items from the collection. Default: `CMS_EDITOR` - name: read | type: Role | description: Role required to read collection items. Default: `SITE_MEMBER_AUTHOR` - name: revision | type: string | description: Collection's current revision number, which increments each time the collection is updated. For an update operation to succeed, you must specify the latest revision number. - name: plugins | type: array | description: Plugins the collection uses. Plugins apply additional capabilities to the collection or extend its functionality. - ONE-OF: - name: publishOptions | type: PublishPluginOptions | description: Options for the Publish plugin. This plugin allows items in a [data collection](https://dev.wix.com/docs/rest/business-solutions/cms/data-collections/data-collection-object.md) to be marked as draft or published. Published items are visible to site visitors, while draft items are not. - name: defaultStatus | type: Status | description: Default status. - enum: PUBLISHED, DRAFT - name: singleItemOptions | type: SingleItemPluginOptions | description: Options for the Single Item plugin. - name: singleItemId | type: string | description: GUID of the single item in this collection. If you insert or update an item, its GUID value is always changed to this. - name: urlizedOptions | type: UrlizedPluginOptions | description: Options for the Urlized plugin. - name: format | type: Format | description: Encoding method for generating a URL in ASCII characters. - enum: - ORIGINAL: Letters are converted to lower case and spaces are replaced with dashes before generating the encoded URL. - PLAIN: No changes are made before generating the encoded URL. - name: multilingualOptions | type: MultilingualOptions | description: Options for the Multilingual plugin. - name: translatableFieldKeys | type: array | description: IDs of fields to allow translation. - name: editablePageLinkOptions | type: PageLinkPluginOptions | description: Options for the PageLink plugin. - name: isPersisted | type: boolean | description: - name: isMutable | type: boolean | description: - name: cmsOptions | type: CmsOptions | description: Options for the CMS plugin. - name: siteSort | type: SiteSort | description: CMS sort, applied when a collection is displayed on a site. - name: sort | type: array | description: Field and order for the site sort. - name: type | type: Type | description: Plugin type. - enum: - PUBLISH: Allows items to be marked as either draft or published. For each item you can set a publishing time when the item will become visible to site visitors. - SINGLE_ITEM: Ensures the collection can have one item at most. Can only be applied to a new collection. - URLIZED: Generates item URLs for collections used by dynamic pages. - GRIDAPPLESS: Deprecated. Will be removed in the future. - MULTILINGUAL: Indicates that the collection is translatable. This allows you to manage translation for selected fields using [Wix Multilingual](https://www.wix.com/app-market/wix-multilingual). - SHARED: Indicates that collection is shared with current site. - EDITABLE_PAGE_LINK: Indicates that page link fields are persisted and can be updated. - CMS: CMS-specific collection properties. - name: pagingModes | type: array | description: Paging modes the collection supports. In native collections, offset-based paging is supported by default. - enum: - OFFSET: Offset-based paging. - CURSOR: Cursor-based paging. - name: _createdDate | type: Date | description: Date the collection was created. - name: _updatedDate | type: Date | description: Date the collection was last updated. ``` ### Examples ### updateDataCollection ```javascript import { collections } from '@wix/data'; async function updateDataCollection(collection) { const response = await collections.updateDataCollection(collection); }; ``` ### updateDataCollection (with elevated permissions) ```javascript import { collections } from '@wix/data'; import { auth } from '@wix/essentials'; async function myUpdateDataCollectionMethod(collection) { const elevatedUpdateDataCollection = auth.elevate(collections.updateDataCollection); const response = await elevatedUpdateDataCollection(collection); } ``` ### updateDataCollection (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { collections } from '@wix/data'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { collections }, // Include the auth strategy and host as relevant }); async function updateDataCollection(collection) { const response = await myWixClient.collections.updateDataCollection(collection); }; ``` ---