Create User in database using authentication provider (facebook, google...)


I am using the facebook authentication provider to let my user login.
Once they log in, i can find them in the App User Menu of the mongodb atlas page.
I would like to have those authenticated Users in my database.

How can i automatically add those users to my database?
Is there any built-in functionality ?

Should i do it manually in my code such as :

  • everytime the user login, i
  • check in the database if the user exists,
  • if he does not exist, I create the user in my database
  • if he exist, i dont do anything

Best regards