I am currently storing all documents’ ids and references as ObjectId rather than string.
To send documents from my Flask app to my frontend, I have to convert all ObjectIds to string first. This is due to the error TypeError: Object of type ObjectId is not JSON serializable
When my server receives documents from my frontend, I have to convert these strings back to ObjectIds before performing an update operation on the document.
I am contemplating storing all id as strings in order to avoid performing these two additional steps. However, I understand that ObjectId is more efficient which is why I have been resisting this change.
Would really appreciate some advice on how should I handle this situation.