Purpose

Specifies the minimum default length, in characters, of fields that are mapped as VARCHAR. The default length of VARCHAR columns is 1.5 times the largest data value the driver samples from the column. When the default length is less than the value specified for this property, the driver increases the default length to the value set for this property. Setting this property to a larger value than the calculated default allows for larger data values to be inserted by the driver.

Valid Values

x

where:

x

is the maximum size of the default length in characters given to columns that are mapped as VARCHAR.

Example

For example, MinVarcharSize is set to 1000, but the driver calculates a default length to be 500 based on the values sampled in your MongoDB STRING data column. Since the calculated value would be less than the setting of MinVarcharSize, the length is set to 1000. Conversely, in another column, the driver samples larger values and calculates a default length of 3000. Because the calculated value exceeds that of the MinVarcharSize property, the length would be set to 3000.

Notes

  • The StringTruncationMethodForWrites property determines the behavior of the driver when inserting String values that exceed the column length defined in the relational schema.

Data Source Methods

public Integer getMinVarcharSize()

public void setMinVarcharSize(Integer)

Default Value

1

Data Type

Integer