diff --git a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mongodb/MongoDBDatabaseSync.java b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mongodb/MongoDBDatabaseSync.java index eac6acc48..79c261d0c 100644 --- a/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mongodb/MongoDBDatabaseSync.java +++ b/flink-doris-connector/src/main/java/org/apache/doris/flink/tools/cdc/mongodb/MongoDBDatabaseSync.java @@ -114,7 +114,7 @@ public List getSchemaList() throws Exception { throw new IllegalStateException("No documents in collection to infer schema"); } - long totalDocuments = collection.countDocuments(); + long totalDocuments = collection.estimatedDocumentCount(); long sampleSize = (long) Math.ceil(totalDocuments * samplePercent); ArrayList documents = sampleData(collection, sampleSize); MongoDBSchema mongoDBSchema =