parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Use alternative NoSQL databases?

Open jashsayani opened this issue 10 years ago • 115 comments

MongoDB is a great NoSQL database choice, but I had a few concerns:

  1. I don't want to rely on MongoLab or another Database-as-a-service. I learn from experiences.
  2. I don't want to install MongoDB on a compute instance and update versions, feed it RAM

I want to use either Google Datastore or Amazon DynamoDB. Both are good NoSQL database choices. Google: https://cloud.google.com/datastore/ Amazon: https://aws.amazon.com/dynamodb/details/

I think it would be nice to be able to interface with alternative NoSQL databases other than MongoDB.

jashsayani avatar Jan 29 '16 07:01 jashsayani

Should be fairly easy to add if I'm right. You would just need to implement a DatabaseAdapter similar to https://github.com/ParsePlatform/parse-server/blob/master/ExportAdapter.js for your desired database

duergner avatar Jan 29 '16 07:01 duergner

See the wiki about ExportAdapter... There is still some work to do in modularizing the database layer, but it's part of the vision for sure.

gfosco avatar Jan 29 '16 08:01 gfosco

+1 I don't want to rely on MongoLab either. It'll be awesome if we have full control over the db.

davidaik avatar Jan 29 '16 15:01 davidaik

What about RethinkDB?

francocorreasosa avatar Jan 29 '16 20:01 francocorreasosa

thinking about adding support for Azure DocumentDB if there is interest.

ghost avatar Jan 29 '16 20:01 ghost

@ryancrawcour Great

francocorreasosa avatar Jan 29 '16 20:01 francocorreasosa

Is the plan for Parse to use the ~~ExportAdapter~~DatabaseAdapter class to do the migration to databases other than MongoDB? For example, if I were to implement my own ~~ExportAdapter~~DatabaseAdapter for DynamoDB, will I be able to have Parse use that adapter to fill up my new DynamoDB table(s)?

richardkazuomiller avatar Jan 30 '16 00:01 richardkazuomiller

If you look through the Parse code you will see that not all the Mongo code is contained within just DatabaseAdapter and ExportAdapter.

For instance, users.js has direct Mongo code.

This seems to be what @gfosco was talking about when he said that complete modularization hasn't been completed yet.

My question is how much work is required to totally modualrize datavase access?

ghost avatar Jan 30 '16 00:01 ghost

Not much (famous last words).. Turn transform.js into ExportTransformAdapter.js and create a TransformAdapter (like FilesAdapter) which defaults to it. Make Schema.js and any other module which accesses transform use the adapter class, and allow it to be injected at initialization.

gfosco avatar Jan 30 '16 04:01 gfosco

Of course, there's a lot more to it I'm sure. The same methods used in ExportAdapter may not always fit some other system, or other unforeseen differences..

gfosco avatar Jan 30 '16 04:01 gfosco

Yeah honestly this part of the design is a bit wack. Ideally all the Mongo access should be contained within DatabaseAdapter and ExportAdapter but at some point we got to a tradeoff between feature completeness and modular design, and decided to move towards feature completeness. Especially around supporting some of the stranger $ operators. I'm not sure how hard it would be to make more adapters and it may or may not be tractable.

lacker avatar Jan 30 '16 06:01 lacker

I never used Parse, but I know people who did and it seems like the main of it was that they didn't have to provision and maintain their own servers. In my opinion, the stateless application layer is not so hard to maintain but going from no servers to maintaining a MongoDB replica set or even working with MongoLab is a big jump for people. I think complete support for adapters so we can use DBaaS like Google Cloud Datastore and DynamoDB should be a priority.

richardkazuomiller avatar Jan 30 '16 10:01 richardkazuomiller

I think we need to:

  1. Modularize/isolate the database code. The database adapter should have a small transport layer that is MondoDB. Optionally, you can write your own transport layer with a different database provider.
  2. Clearly document the APIs for the database part, so its really easy to read docs/comments and implement custom transport layers.
  3. Work on transport layers for Google Cloud Datastore and Amazon DynamoDB. If 1 and 2 are in place, I am sure the community will start writing these.

jashsayani avatar Jan 30 '16 22:01 jashsayani

@jashsayani sounds like a plan d(^_^)

richardkazuomiller avatar Jan 30 '16 22:01 richardkazuomiller

@jashsayani I'm keen to contribute to the core and to building an adapter for Azure DocumentDB

ghost avatar Jan 30 '16 23:01 ghost

@ryancrawcour I don't think Azure DocumentDB is the best choice since Azure is not as main stream as AWS. So if Microsoft does not see Azure bringing significant revenue in the future, they might restructure it or cancel services. AWS on the other hand is a proven success and DynamoDB is not going anywhere.

Google Cloud Datastore is also a gamble like Azure, but its a shiny new thing and looks promising. Is there a specific reason why you want to use Azure?

jashsayani avatar Jan 31 '16 01:01 jashsayani

@jashsayani trust me, Azure isn't going anywhere :)

ghost avatar Jan 31 '16 01:01 ghost

@jashsayani I think the fact that @ryancrawcour is in the Azure GitHub organization might have something to do with why he'd like to use Azure lol

richardkazuomiller avatar Jan 31 '16 02:01 richardkazuomiller

@richardkazuomiller Haha. Yes, I saw his profile. He's a Microsoft employee working on Azure. So it makes sense. Good to see Microsoft evangelizing on Github.

I found a really good helper library from Google, which will make it easy to build a transport with Datastore: https://googlecloudplatform.github.io/gcloud-node/

jashsayani avatar Jan 31 '16 02:01 jashsayani

I am trying to make support for Google DataStore. Any quick advices how to do it best way .?

saleehk avatar Jan 31 '16 09:01 saleehk