Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from mongodb to firebase

My app currently uses mongodb and I'm looking forward to migrating it to firebase instead.

How easy is it to do and are there things I have to watch out for.

like image 291
Harry Avatar asked Apr 16 '13 17:04

Harry


3 Answers

Given that both MongoDB and Firebase are non-relational in nature, most of your data should map to Firebase cleanly. The Firebase REST endpoints support regular JSON, so getting your data in (and, back out if you choose) should also be easy. The main areas you need to keep watch for are:

  1. The Firebase API is realtime/asynchronous in nature; specifically, when clients are reading data. Migrating your backend request/response code to the client and using this approach will probably be the biggest area with regard to level of effort.
  2. There will also be a disparity in the feature set that MongoDB and Firebase provide; notable areas include Mongo's support for doing things like MapReduce, Cursors, and free-text queries (Firebase doesn't currently support these areas).

The other thing to keep in mind is that Firebase isn't an all-or-nothing type of undertaking. Apps can definitely take advantage of the realtime, scaling, and platform features piecemeal.

like image 59
Vikrum Avatar answered Nov 03 '22 12:11

Vikrum


Not specifically answering the question, but if you find Firebase lacking a few features which you you are used to with Mongo -

I found a node package which will allow you to run both with Firebase as the master DB.

Firebase

  • Security/Authentication
  • Sockets

MongoDB

  • querying
  • indexing
  • aggregation

https://www.npmjs.org/package/mongofb

like image 31
Gravy Avatar answered Nov 03 '22 11:11

Gravy


Isn't Firebase stores all its data in MongoDB?

Update May 2016

Apparently a page where Firebase was mentioned in MongoDB's site was removed (http://www.mongodb.org/about/production-deployments/)

After some search on their site I've found another page in their blog https://www.mongodb.com/post/45270275688/mongodbs-growing-ecosystem (mirror) where they say:

it’s great to see so many companies building on MongoDB. Here are just a few:

  • Modulus. A Node.js platform as a service (PaaS) offering, Modulus includes MongoDB as its default data store. This follows related offerings from Meteor and Firebase.

An alternative to MongoDB would be RethinkDB and recently the team behind RethinkDB released Horizon, an open-source backend platform on NodeJS and that is kind of a locally hosted Firebase. Here's a nice talk about Horizon.

like image 8
Steven Pribilinskiy Avatar answered Nov 03 '22 11:11

Steven Pribilinskiy