{"record":{"id":"51c84d80befdc62d","repo":"prestodb/presto","slug":"not-supported-51c84d","errorCode":"NOT_SUPPORTED","errorMessage":"Can't convert json to MongoDB Document: %s","messagePattern":"Can't convert json to MongoDB Document: (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":400,"severity":"error","filePath":"presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSink.java","lineNumber":187,"sourceCode":"            // TODO: decimal type might not support yet\n            // TODO: this code is likely wrong and should switch to Decimals.readBigDecimal()\n            DecimalType decimalType = (DecimalType) type;\n            BigInteger unscaledValue;\n            if (decimalType.isShort()) {\n                unscaledValue = BigInteger.valueOf(decimalType.getLong(block, position));\n            }\n            else {\n                unscaledValue = Decimals.decodeUnscaledValue(decimalType.getSlice(block, position));\n            }\n            return new BigDecimal(unscaledValue);\n        }\n        if (isJsonType(type)) {\n            String json = type.getSlice(block, position).toStringUtf8();\n            try {\n                return parse(json);\n            }\n            catch (BsonInvalidOperationException e) {\n                throw new PrestoException(NOT_SUPPORTED, \"Can't convert json to MongoDB Document: \" + json, e);\n            }\n        }\n        if (isArrayType(type)) {\n            Type elementType = type.getTypeParameters().get(0);\n\n            Block arrayBlock = block.getBlock(position);\n\n            List<Object> list = new ArrayList<>(arrayBlock.getPositionCount());\n            for (int i = 0; i < arrayBlock.getPositionCount(); i++) {\n                Object element = getObjectValue(elementType, arrayBlock, i);\n                list.add(element);\n            }\n\n            return unmodifiableList(list);\n        }\n        if (isMapType(type)) {\n            Type keyType = type.getTypeParameters().get(0);\n            Type valueType = type.getTypeParameters().get(1);","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSink.java#L169-L205","documentation":"MongoDB sink conversion error in getObjectValue: a Presto value of some type could not be converted into a MongoDB Document/BSON value (unsupported or mismatched type encountered while writing a row). The %s describes the offending JSON/type; this fires during INSERT into a MongoDB table.","triggerScenarios":"Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSink.java:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Cast the problematic column to a BSON-supported type (string, double, etc.) before insert","Avoid writing types the MongoDB connector does not support (e.g. some decimals/time zones)","Restructure nested types into simpler BSON-compatible shapes"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}