I am trying to convert type primitive.ObjectID to string type in Go. I am using mongo-driver from go.mongodb.org/mongo-driver.
I tried using type assertion like-
mongoId := mongoDoc["_id"];
stringObjectID := mongoId.(string)
Which VSCode accepts. Code gets compiled and when it reaches this specific line of code, it throws this error
panic: interface conversion: interface {} is primitive.ObjectID, not string