How to write ObjectId value using Spark connector 10.1 using Pyspark?

I have tried above options:

  • But READ is always getting ObjectId as “string” from MongoDB 6.0/PySpark 3.4.0
  • WRITE is always writing any thing I try - as “string” to: MongoDB 6.0/PySpark 3.4.0

I am using MongoDB Spark Connector 10.0.4 driver

Really appreciate if anyone can share exact steps with sample code that works. This is important requirement for us - to at least WRITE back as ObjectId - I can live with READ coming on existing ObjectId as string worst case