CollectionsCollections Database

Protocols

A protocol defines a specific behavior of a value (or a field). A value conforms to a protocol when it satisfies the requirements of that protocol.

A value can conform to multiple protocols, so it can have different behaviors.

Equatable

The value can be determined as equal to another value. For example, a String can be equal to another String, a Document reference can be equal to another reference if they're pointing to the same document.

Comparable

The value can be compared to another value (greater than, less than or equal to). For example, 8 is greater than 6, or the date February 2nd, 2000 is less than February 5nd, 2000.

Convertible to string

The value can be converted to a String. For example, a Date value value will be converted into a formatted string, a Document reference will return the document title, a Selection will return the formatted items separated by a comma.

Convertible to number

The value is convertible to number. For example, a Time interval value will return the seconds as a number.

Convertible to color

The value is convertible to color. For example, a List item can return its associated color. This protocol is used to determine the color of a marker in the map view (Explorer).

Container

The value is convertible to container (a list of generic items). For example, a container can return the items count or the first item in the list. Group, Selection, Documents selection, Managed documents conform to the container protocol.