0

I am trying to wrap my head around this so here goes.. Can I use firebase authentication with mongodb? I am trying to build a sort of message board using the mern stack and I hate dealing with authentication. How would I store the user in mongodb and have linked to for example a certain comment that was left by them? I just need some direction or possible some alternatives. Thanks

1 Answer 1

1

This is just a completely basic answer, many people do have a lot more knowledge about this than me. But, to answer your question: yes, you can use firebase authentication with MongoDB. When a person is making a user on your page, you can easily make a document inside MongoDB where all the user's data is stored. When you want to link your user to a comment, your database may look something like this:

Comments (collection) - 'random id' - user: 'firebase uid', comment: 'Hello world!', timestamp: '6th of March, 20:24' (document)
         - 'random id2' - user: 'firebase uid', comment: 'Hello StackOverflow!', timestamp: '2nd of March, 23:59' (document)

You could of course design your database otherwise, and there is 100% a much more effective way, but this will hopefully give you a direction to where to start.

I assume you somewhat know how to use MongoDB and Firebase Authentication.

Sign up to request clarification or add additional context in comments.

2 Comments

This makes complete sense to me, Thank you. You know sometimes how you just can't visualize how to do something, I was going through that. I appreciate the feedback
Glad I could help. We all have some times when we just don't know where to get started, and therefore other people are there to help. Good luck with your project!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.