{"record":{"id":"fa55d0be3f794627","repo":"apache/seatunnel","slug":"unsupported-operation-fa55d0","errorCode":"UNSUPPORTED_OPERATION","errorMessage":"By utilizing flatSyncString, only one field attribute value can be set, and the field type must be a String. This operation will perform a string mapping on a single MongoDB data entry.","messagePattern":"By utilizing flatSyncString, only one field attribute value can be set, and the field type must be a String\\. This operation will perform a string mapping on a single MongoDB data entry\\.","errorType":"error_code","errorClass":"MongodbConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/serde/DocumentRowDataDeserializer.java","lineNumber":57,"sourceCode":"\n    private final boolean flatSyncString;\n\n    public DocumentRowDataDeserializer(\n            String[] fieldNames, SeaTunnelDataType<?> dataTypes, boolean flatSyncString) {\n        if (fieldNames == null || fieldNames.length < 1) {\n            throw new MongodbConnectorException(ILLEGAL_ARGUMENT, \"fieldName is empty\");\n        }\n        this.bsonConverters = new BsonToRowDataConverters();\n        this.fieldNames = fieldNames;\n        this.fieldTypes = ((SeaTunnelRowType) dataTypes).getFieldTypes();\n        this.flatSyncString = flatSyncString;\n    }\n\n    @Override\n    public SeaTunnelRow deserialize(BsonDocument bsonDocument) {\n        if (flatSyncString) {\n            if (fieldNames.length != 1 && fieldTypes[0].getSqlType() != STRING) {\n                throw new MongodbConnectorException(\n                        UNSUPPORTED_OPERATION,\n                        \"By utilizing flatSyncString, only one field attribute value can be set, and the field type must be a String. This operation will perform a string mapping on a single MongoDB data entry.\");\n            }\n            SeaTunnelRow rowData = new SeaTunnelRow(fieldNames.length);\n            rowData.setField(\n                    0, bsonConverters.createConverter(fieldTypes[0]).convert(bsonDocument));\n            return rowData;\n        }\n        SeaTunnelRow rowData = new SeaTunnelRow(fieldNames.length);\n        for (int i = 0; i < fieldNames.length; i++) {\n            String fieldName = this.fieldNames[i];\n            BsonValue o = bsonDocument.get(fieldName);\n            SeaTunnelDataType<?> fieldType = fieldTypes[i];\n            rowData.setField(i, bsonConverters.createConverter(fieldType).convert(o));\n        }\n        return rowData;\n    }\n}","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/serde/DocumentRowDataDeserializer.java#L39-L75","documentation":"With flatSyncString enabled, the MongoDB deserializer maps each whole BSON document to a single string field, which is only valid when the row schema has exactly one field of type STRING. The check enforces this contract; note the condition uses && so a mismatched multi-field or non-string schema triggers the throw.","triggerScenarios":"Enabling flatSyncString=true (flat.sync-string option) while the SeaTunnel schema has more than one field, or its single field's SqlType is not STRING; deserialize then validates the contract and throws UNSUPPORTED_OPERATION.","commonSituations":"Users set flatSyncString to read documents as raw JSON strings but leave a multi-column or non-string schema; copy-pasted config where schema and flatSyncString options conflict; prior version allowed it and a connector update started validating.","solutions":["When using flatSyncString, declare a schema with exactly one STRING field (e.g. single field 'value' or 'document').","Disable flatSyncString if you need multiple typed columns and define a proper multi-field schema instead.","Ensure the single field's type is STRING (not BYTES/ROW) so the converter serializes the whole document to a string.","Review the connector docs for the flatSyncString contract before enabling it."],"exampleFix":"// before: flatSyncString=true with multi-field schema\nfields { id, name } // throws\n// after: single STRING field\nfields { document } // document: string, compatible with flatSyncString","handlingStrategy":"validation","validationCode":"// validate before enabling flatSyncString\nboolean valid = rowType.getTotalFields() == 1 && rowType.getFieldType(0).getSqlType() == SqlType.STRING;","typeGuard":null,"tryCatchPattern":"try { row = deserializer.deserialize(doc); } catch (MongodbConnectorException e) { if (e.getMessage().contains(\"flatSyncString\")) { log.error(\"flatSyncString requires exactly one STRING field\"); throw new ConfigException(e); } throw e; }","preventionTips":["Only enable flatSyncString when the schema is a single STRING column","Document the flatSyncString constraint in job config templates","Validate config+schema combinations in CI before deployment","Prefer a multi-field schema over flatSyncString for typed reads"],"tags":["mongodb","flatsyncstring","schema","configuration"],"backgroundTag":"conflicting-config-options","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}