I was storing data received from an API in Mongodb, and just realized the data was containing an _id, so that, while doing the insert, Mongodb did not create an objectid but inserted the string _id I receive.
So now, I want to convert from string _id to objectid. What is the best strategy to do so?
- new_oid = ObjectId(string_id) - timestamp is maintained but machine id & pid coded in the string_id will not be consistent with my server & pid that store the data
- new_oid = ObjectId() - timestamp is lost, but machine id & pid coded in new_oid will be consistent with the server that actually stored the data
Thanks!