I have a str as follows:
str = "ObjectId('60fe547ce9d9f9fd5f03bdab')"
I want to convert it to bson.objectid
. Since the ObjectId()
function only requires the 24 digit hex string so I am achieving this with string manipulation which is definitely not the right way:
obj = ObjectId(str[10:34])
Is there a standard way or any better way to achieve this.
Edit: I receive the string data in an HTTP POST request