Firebase vs MongoDB: Which One is the Best for Your Next App?

A comparison of Firebase and MongoDB to help you figure out which is best suited for your next project.

Chukwuemeka Maduekwe
3 min readFeb 20, 2022
comparism between firebase and mongodb

I’m still confused about their pricing.

If this question has ever occurred to you, you’re not alone, you just joined the massive list of developers whom the question has been thrown at. Don’t expect me to say one is better than the other in all aspects, I do believe they both have their strengths and room for improvements, also I don’t believe giving people answer straight out, but I’ll try to lay tracks to the answer you require, it’s left for you now to decide the needs of your project and which Database has something better to offer. I’ve used both recently and I enjoin you to do so, in order not for you to jump to a conclusion saying I’ll use this database next.

They are both NoSQL Databases and share some capabilities.

  1. Initial Release: MongoDB was released earlier than Firebase in 2009 and has been consistent, in the sense that upgrades have not led to many breaking changes in codes, it took me some time to fix my code after updating firebase from ^8.8.0 to the latest SDK ^9.6.5 and I haven’t experienced such with MongoDB. Firebase was released in 2012; Three years after MongoDB.
  2. Performance: Firebase is best for small-scale apps, while MongoDB is seamless even with high traffic.
  3. Security: Like I’ve seen and read most of the time, even though Firebase is said to have its own authentication mechanism, it's said that it’s not as secure as MongoDB.
  4. Realtime: To me this is the greatest strength of firebase which it offers out of the box without any configuration. With MongoDB, you’ll have to use sockets or other methods to make MongoDB real-time. In the sense that you can set up a listener for changes in firebase and update the UI once a change is detected.
  5. Pricing: There’s no fixed cost for Firebase, but depending on your pocket, if you host MongoDB on your server it’s free but with Atlas, you’ll pay, though they have a free version, while Firebase is paying as you go.
  6. Serverless: Firebase is more of a Serverless approach, you’ll need a Server for security reasons if you’re to use MongoDB, though you now have an option of using realm.
  7. Development: MongoDB can be run locally and as such does not require an internet connection except if your database is hosted online, but for Firebase, you have to be connected while developing.
  8. Queries: One of the reasons I enjoy using MongoDB, is that it has a query for almost everything you can think of, be it objects, arrays, dates, etc. Recently I discovered you can’t update an object in an array with Firebase. This is an aspect where firebase is lagging and needs improvement.

Final Notes

Firebase offers an array of functionalities other than Firebase/Firestore (Database) such as Storage, Cloud Messaging, and Authentication. Though its queries can be improved and breaking changes reduced.

MongoDB, on the other hand, is quite older and has been consistent, their latest addition, Atlas search has been great and in the future, we’d love to see authentication and storage incorporated as Firebase as done.

I understand am asking for much, but it’s just what I think the community will love to see.

More content at PlainEnglish.io.

Sign up for our free weekly newsletter. Follow us on Twitter, LinkedIn, YouTube, and Discord.

--

--

No responses yet