1; I try to use valuetokey to change partition key with error "Only Struct objects supported for [copying fields from value to key], found: java.lang.String" ; 2; I want update The source code MongoSourceTask.poll() for return struct type, but couldn't change it;
how to solve it,thanks

You shouldn't modify the connector source code.
You can use JSON (with schemas enabled), Avro, or Protobuf to get a Struct type with accessible fields
From your error, sounds like you'd used the StringConverter or JSONConverter with schemas disabled