Why is node.js widely used to operate non-relational databases?

question: why is the node.js seen on the Internet used to manipulate databases are generally non-relational databases, relational databases (mysql) is rare?

Oct.21,2021

I wonder if you've ever heard the phrase "full stack programmer (Full stack)", which requires you to be able to do it alone from front to back. If the ability is strong enough, of course, you can match the front and rear technology at will. The problem is that the cost of learning is too high for most people, so the Rank of "full-stack programmer" is more difficult to achieve. If you want to reduce the difficulty to a certain extent, a path to "full stack programmer" can be MEAN Stack, which means

, respectively.
  • MongoDB
  • Express
  • Angular
  • NodeJS

because it's all based on JS, you can eat all the front and back ends in one language, reducing the learning burden and the things you need to remember to some extent.
think of it another way, because the front end can't get out of the palm of JS anyway, and one more language on the back of the technology stack is a bit more burden. From the most convenient point of view, of course, it is to choose JS as the server and JS to operate the database. So the logical choice is NodeJS+MongoDB.

in addition, from an adaptive point of view, JS is not very good at describing business logic, and some people even think that its syntax is anti-human (although I don't agree) and is not suitable for compute-intensive scenarios. Its advantage lies in its strong concurrency ability, so it is suitable for Imax O-intensive scenarios. So once a project chooses NodeJS, it generally means that you care more about concurrency. Compared with the relational database, the non-relational database represented by MongoDB obviously has the advantages of concurrency and horizontal scalability, so its collocation with NodeJS is more reasonable.
, in turn, looks back and forward, if it is decided in the first place that the database must use a relational database, probably because it involves strong transactions or complex relationships. In such scenarios, the logic is usually more complex. Based on the previous reasons (the logic description ability is not strong), NodeJS is not likely to be chosen when choosing the back-end language.

in addition, there are situations where the logic is complex but does not involve transactions or complex relationships. If the business logic of a project is complex, you will probably choose something like Java/C-sharp/PHP instead of NodeJS, at first. At this time, there are no clear restrictions on the back-end database, as long as it is applicable. In this case, you will find that these languages are common with relational databases or MongoDB, depending on which one you are more familiar with.

in short, you see that NodeJS with RDBMS is less, because most of the time it doesn't make sense.


mongodb is the one that should be used more.

I think the main reason is that mongodb uses bson, which is similar to json, as the storage and transmission format, and js is very friendly to the parsing of this format; in addition, mongodb officially provides the driver of nodejs

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3b5ea-2c26c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3b5ea-2c26c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?