Why is Mongodb prefered over MySql for NodeJs development? [closed] - mysql

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Please read before you answer: I don't need any opinion-based answers or "nosql vs sql which is better" debates on the subject, just facts.
I want to slowly convert a php+mysql website I wrote with Symfony2 into a real time application using backbone with nodeJs + websockets.
I want to make a slow transition by changing single features, since I don't want to break a fully functional site.
I have been educating myself about NodeJs by reading books and watching Tutorials and there is one thing I noticed, I own more than 5 nodeJs books and none of them use MySql although its fully supported by node.
They all use MongoDB.
Here is my situation
1. My Website is already integrated into MySql(Doctrine)
2. My MySQL setup is fully functional and needs no improvements so far
I'm really frustated and I have a few questions:
Why is MySql not prefered although its a more mature piece of technology?
What are the advantages of moving to MongoDB over MySQL for the purpose of having a real-time application??

I've seen people choose Node/Mongo development because of the simplicity of the all-JavaScript stack, I've seen people choose Mongo because it's the New Hotness, and I've seen people choose Mongo because it's actually the right tool for the job: they have a large amount of document-like, unstructured data and/or they want to take advantage of Mongo's support for horizontal scaling, among other differences between MySQL and Mongo.
I'm not sure it's possible to answer this question in a non-opinion-based manner and without touching on Sql vs NoSql. Mongo is simply a tool, and it happens to be free and commonly used in the field with Node. If I were writing a Node tutorial, I'd probably choose Mongo too, because it's common and it's cool.
If Mongo is the right tool for your site's use cases, then the transition is probably worth it. If MySQL is the right tool for your site, then congratulations! You've just saved a bunch of time rewriting your DB in Mongo.
As an aside- if your question uses the word "preferred", I can't really think of a way for it to not be opinion-based, by definition.

Related

Why do some people prefer SQLite over MySQL? I am a MSSQL user [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I am curios why some prefer MYSQL over SQLITE, i am interested on learning MYSQL
SQLite is an embedded library, it requires no server process, and everything it saves is contained within a single, portable file. MySQL is an RDBMS server that's a lot more work to set up, but is multi-user, more scalable, and far more featured.
For example, SQLite is used for mobile applications as well as "development" instances of code where it's only lightly loaded. It can be used at scale but generally isn't, its simple design has limitations.
If you're writing a mobile application and need a local database, SQLite is not a bad call. Spinning up a huge, cumbersome MySQL process to do the same thing on a mobile device is a bad plan.
Although they're both "SQL databases" and have a lot of functional overlap, they're engineered to solve some very different problems. In some trivial use cases it might be an arbitrary choice as to which is best, but in most cases it's pretty obvious which of the two you need.

Is PostgreSQL or MySQL more popular with Node.js? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
In absolute terms, Postgres has more features and has been used at scale by Instagram, etc. while MySQL has a much bigger user base and has been used at scale by likes of Facebook, Quora, etc. But how about in combination with NodeJS?
Which is more popular with NodeJS?
MySQL is probably more popular, solely in terms of userbase. (You sorta answered this yourself)
MySQL probably has more examples around the net which could help make things easier to set up. You'll probably also find MySQL more likely to come preloaded on a VPS if that's the sort of route you're taking. However setting up PostgreSQL on your server is not difficult, and there is plenty of documentation available.
It really depends on what your intentions are with your data. Digital Ocean wrote a nice concise comparison of MySQL and PostgreSQL found here
As far as how these play with node.js, in my experience the node modules for PostgreSQL and MySQL are equally pleasant to work with. Ultimately its more about picking the database that suits your data and what you want to do with your data. Then deciding how it fits into your node stack.

Which database engine is best for node.js apps? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am looking for a database engine which is the best for storing thousands of records. I first wanted to use MySQL, because I know it best, but I'd like to have strong answer.
I need predefined columns, database can be as small as 10 MB or as "big" as 10 GB of data and it would be cool if that engine is fast for reads (insertions may be a bit slower). I don't need fast-fulltext-search or regexp searching. To give you an example - selecting items via slug extracted from link.
I saw this site before but I still don't know what is best option for me.
So here is my question: Which database engine is best for uses like mine?
You should look at MEAN stack. Personally, I like MongoDB - I use an ORM tool like mongooseJS - It increases your development speed rapidly. The one thing i really like about having Node JS, Express body parser, mongodb and mongoose is I deal everything on the server side in one language - Javascript and I expose REST services which can be consumed on Web (typically Angular - the A in MEAN stack or backbone) based application.
database can be as small as 10 MB or as "big" as 10 GB of data
At that size, you could use virtually any database you want. Remember, 10 GBs of data is small enough to fit into memory on a modern server.
I need predefined columns...
Sounds like SQL. Take you pick: MySQL, PostgreSQL, SQLite... at that size it will barely matter, just use what you like.
The performance difference on a "few gigs" of data will be negligible.
Look at MongoDB.
And don't forget to look at TokuMX - it's very promising!

Migrate mongodb to mysql? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
as google isn't really helpful here:
what's the best way of migrating a mongodb database to a mysql database? any best practise examples?
thanks!
After you have completed scarpacci's exercise and have an idea of the mappings, I would then look at mongoexport - you should be careful about type fidelity though and then you will have to import the CSV/TSV into MySQL in a sane manner also.
The other option, especially if you run into typing issues, is to simply pull all of your data out programmatically using your language and driver of choice and insert it directly into MySQL, again using your favorite driver - this gives the most control, but is also the most work.
This might be a bit of a non-starter, because people usually implement things in Mongo or other NoSQL databases in order to have a schemaless design. That is diametrically opposed to the concept of a relational database.
Without looking at the sort of data structures you have in Mongo, this would be impossible to answer.
#Tronic I would start by utilizing the mappings MongoDB provides on their site:
Mapping Guide
I would then try and take your documents in each of your collections and try to break those out into the proper DB Entities (Tables). The entities / attributes could be difficult to design based on the schemaless design of Mongo (As #Mike Brant indicates)
Hope this helps.
--S

MySQL vs File-Based CMS [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm looking for a new CMS to host my new blog and I was deciding what the best route would be, either using MySQL or a file-based CMS.
I'll probably be writing on the blog every other day so I'm looking for speed.
Does anybody know which one would be better for speed / security?
Thanks!
I'd highly recommend one of the popular ones such as Joomla, Wordpress, or Drupal (why re-invent the wheel?). They're heavily supported by the community, so the standard concerns like security and such are usually found and fixed before you're even aware they existed. My personal favorite is Joomla because of the extensive collection of extensions that are available, with a great many of them focused on social media such as twitter and facebook to "spread the word" from what you're putting on your site.
For security, I see storing content in a database as being more secure, as database access requires one more level of authentication than simply storing content in a file.
If a user pokes around your system and finds your include folder, then all content could potentially be exposed by guessing the paths. Since the database is usually abstracted away from your front-end application, accessing its content by simply guessing url paths is much harder to do.
In addition, your application will probably only expose certain fields from your database to the front-end, (assuming your database access functions are properly written to prevent things like SQL injection etc).
Unless you expect seriously high volumes of traffic on your site, you probably won't notice much of a difference between reading from a file vs. reading from a database.