-3

I want to make an ionic app and I need a db. I will use node as backend. Why is it recommended and everyone uses mongodbo as DB for node. Can I use mysql, since I am much more experienced mysql-er than mongodb-er. Thanks for any pros and cons that you guys might have.

Vladimir Despotovic
  • 3,200
  • 2
  • 30
  • 58

1 Answers1

1

Node.js has the ability to work with both MySQL and MongoDB as databases.

If you are working with Node.js and you are pretty new NoSQL I'd recommend using the native Node Driver(mongodb) at first.

Reasons:

  • The syntax between the Node Driver and the Mongo shell is very similar and so you'll get a quicker grasp of how to use MongoDB in general.

  • Models are only useful when you are scaling into a big application
    with a large API that needs to be broken up into a MVC
    system(mongoose being your models).

Pros/Cons of using Mongoose:

Pros:

Biggest Pro is that it has the data validation built into it(requirements of what data you will allow to be added or to update your database). It will take some work to build that yourself.(but not THAT hard) It will abstract away most of the mongoDB code from the rest of the application.

Cons

Biggest con is starting off with schemas right out of the gate will really defeat the purpose of using NoSQL and it will be hard to experience what is good about having a loose structured data system during the stages of rapid development.

Not all of your data operations will nicely fit into a characterization that can be encapsulated with a model. Encapsulation is especially hard initially - unless you have a very clear idea of the data flow before you start (which is ideal, but not easy when you are building something conceptually new and requires a lot of experimentation and change/redesign).

HoldOffHunger
  • 18,769
  • 10
  • 104
  • 133
Hrithik Jaiswal
  • 74
  • 1
  • 2
  • 9