@Internal public class MongoValidationUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Set<org.apache.flink.table.types.logical.LogicalTypeRoot> |
ALLOWED_PRIMARY_KEY_TYPES |
| Modifier and Type | Method and Description |
|---|---|
static void |
validatePrimaryKey(org.apache.flink.table.types.DataType primaryKeyDataType)
Checks that the table does not have a primary key defined on illegal types.
|
public static final Set<org.apache.flink.table.types.logical.LogicalTypeRoot> ALLOWED_PRIMARY_KEY_TYPES
public static void validatePrimaryKey(org.apache.flink.table.types.DataType primaryKeyDataType)
BsonType other than a BsonType.ARRAY. Its value must be unique and immutable in the
collection.
MongoDB creates a unique index on the _id field during the creation of a collection. There are also some constraints on the primary key index. For more detailed introduction, you can refer to Index Key Limit.
As of now it is extracted by MongoPrimaryKeyExtractor according to the primary key
specified by the Flink table schema.
BsonType.DOCUMENT as the _id of the corresponding document.
For example, if have a primary key statement PRIMARY KEY (f1, f2) NOT ENFORCED
, the extracted _id will be the form like _id: {f1: v1, f2: v2}
The illegal types are mostly LogicalTypeFamily.COLLECTION types and LogicalTypeRoot.RAW type and other types that cannot be converted to BsonType by
RowDataToBsonConverters.
Copyright © 2022–2025 The Apache Software Foundation. All rights reserved.