I am starting an app (JS / React) and I'd like to use Firebase Authentication system (because it's powerful), with a MongoDB Database (on MongoDB Atlas -Cloud-) for storing the data ( More efficient than Firestore && I use GraphQL on the backend). I still want to use Firebase auth, because I don't want to dive into the authentication rabbit hole for now...
Firebase generates an id for newly ceated users (sent in tokens), I want then to have a collection 'Users' on Mongo to store data about those users.
Here is my problem : The id generated by firebase auth doesn't fit the id syntax required by MongoDb Atlas, to fit the ObjectId type. Here is an id generated by Firebase :
zOw5ERvHyucA3fPYlXlaa4SI1D23
and here is the error I get from mongo : 'must be a string of 24 hex characters'. Example of a working id :
5e7d4a383cae9a2218b45a55
I could use Stings as primarykey in Mongo but i'd lose the efficiency of ObjectIds. For now I added a 'authId' attribute on my users, but I don't think this is optimal.
What do you think ? Any advice ?
Thanks !