prestodb/presto · error · PrestoException
NOT_SUPPORTED
NOT_SUPPORTED
Error message
Can't convert json to MongoDB Document: %s
What it means
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.
Source
Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSink.java:187
// TODO: decimal type might not support yet
// TODO: this code is likely wrong and should switch to Decimals.readBigDecimal()
DecimalType decimalType = (DecimalType) type;
BigInteger unscaledValue;
if (decimalType.isShort()) {
unscaledValue = BigInteger.valueOf(decimalType.getLong(block, position));
}
else {
unscaledValue = Decimals.decodeUnscaledValue(decimalType.getSlice(block, position));
}
return new BigDecimal(unscaledValue);
}
if (isJsonType(type)) {
String json = type.getSlice(block, position).toStringUtf8();
try {
return parse(json);
}
catch (BsonInvalidOperationException e) {
throw new PrestoException(NOT_SUPPORTED, "Can't convert json to MongoDB Document: " + json, e);
}
}
if (isArrayType(type)) {
Type elementType = type.getTypeParameters().get(0);
Block arrayBlock = block.getBlock(position);
List<Object> list = new ArrayList<>(arrayBlock.getPositionCount());
for (int i = 0; i < arrayBlock.getPositionCount(); i++) {
Object element = getObjectValue(elementType, arrayBlock, i);
list.add(element);
}
return unmodifiableList(list);
}
if (isMapType(type)) {
Type keyType = type.getTypeParameters().get(0);
Type valueType = type.getTypeParameters().get(1);View on GitHub (pinned to 55bb57d202)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSink.java:187 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
Background: Presto NOT_SUPPORTED error: what "not supported" means and how to fix it — this error's family across 3 libraries.
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/51c84d80befdc62d.
Report an issue: GitHub.