ArrayItems¶
class ArrayItems<in T>(val items: Schema.ArrayItems.ArrayItemsConfiguration<T>, factory: BsonFactory) : Schema.ComplexConstraint<Collection<T>>
This property must have items following the specified configuration.
If the property does not contain an array, this constraint is ignored.
Constructors¶
ArrayItems¶
constructor(items: Schema.ArrayItems.ArrayItemsConfiguration<T>, factory: BsonFactory)
Types¶
ArrayItemsConfiguration¶
sealed class ArrayItemsConfiguration<in T> : BsonFieldWriteable
Heterogeneous¶
class Heterogeneous<T>(
val items: List<Schema<T>>,
val additionalItems: Schema<T>?,
factory: BsonFactory
) : Schema.ArrayItems.ArrayItemsConfiguration<T>
Pass this value to ArrayItems to specify that each item has its own schema.
Homogenous¶
class Homogenous<T>(val schema: Schema<T>, factory: BsonFactory) : Schema.ArrayItems.ArrayItemsConfiguration<T>
Pass this value to ArrayItems to ensure that all items in an array conform to schema.
Properties¶
items¶
Specifies constraints on the items of the array.
-
Homogenous: all items must have the same shape. -
Heterogeneous: items can have different shapes.
Functions¶
toString¶
writeTo¶
@LowLevelApi
open override fun writeTo(writer: BsonFieldWriter)
Writes this object to the provided writer.