Add MySQL Database Option



  • Hi,
    I don't know how possible it actually is to add MySQL functionality, but having it is a must for me. I use MySQL in nearly all of my Node apps. I have grown so accustomed to it that I didn't feel the need to keep researching into Mongo. Maybe that was a mistake on my part. I don't want to sound arrogant, but I feel like having a relational database option is a little important considering it is used more than 50% of the time. I am not saying that Mongo or Redis are bad options. I am just saying I think they are quick solutions to a very snazzy application :D. That said, it would probably take a good bit of rewriting to add this database functionality. However, if you guys are up for the task, it might have a better outcome. Plus, more options can't be a bad thing.

    Again, I don't mean to seem needy or anything. Just suggesting a handy feature that could help out a loyal user ;P


  • Community Rep

    @Popatop15 I'm sorry, but it's near to impossible. Take a good look at those examples https://github.com/NodeBB/NodeBB/tree/master/src/database

    The differences between MySQL and any noSQL databases are huge.

    NodeBB architecture was designed with Redis in mind. Redis it's not even a database at all, it's an advanced key-value store (completely noSQL). So, it's relatively easy to make a driver for a noSQL database, like MongoDB. But it would be way too hard to implement that kind of a driver for a relational database, like MySQL.

    Just to be clear - even though, strictly speaking, it is possible to make the driver, NodeBB won't be working good with it anyway.

    Personally I'd suggest you to spend some time to learn how to work with MongoDB, if you still unfamiliar with it. MongoDB is very popular nowadays and working with it is much easier than with anySQL database. If you're an expirienced dev, you can become a ninja in just one week.
    Then, you'll be able to make an effective bridge between Mongo and MySQL parts of your applications.

    p.s. Just in case, I want to mention that everything is possible.


  • Admin

    @Popatop15 Unfortunately, @Mega is correct. It is quite difficult to write a MySQL driver, and although there is demand for it, even if we did, it wouldn't be implemented in the a best-practices way and take advantage of all of MySQL's many features.

    This is not to say that these issues cannot be overcome, but that there is not enough of a reason to do so at this time :smile:



  • Thanks for the replies, guys. I believe that saying Mongo is easier than working with MySQL is a matter of opinion. I find it much easier to work with MySQL, however I do understand the fact that it is easier to work with Mongo on Node specifically considering it is build with JS. All I really want to do is be able to sync user accounts between a few applications to prevent my users from having to create several accounts, or even the same account over again. The problem with Mongo comes in when I need to use MySQL because I have databases that store information gathered from Java apps. I suppose I will just have to suck it up and learn how to do authentication with Mongo so I can hook into NodeBB.

    If it exists, any help or documentation to point me in the right direction would be greatly appreciated. I haven't the slightest clue how to authenticate using Mongo.



  • Or maybe explain the easiest way to make a custom site and integrate that registration into NodeBB, or the other way around?


  • Admin



  • That is pretty interesting, but is there a way to reverse that? So a user can log in or create an account via the main website, instead of having to create a forums account in order to sync it with the main site?


  • Community Rep

    @Popatop15 That's what the plugin does. It reads the cookie from your app. You can turn nodebb registration off completely when using that plugin.



  • @yariplus Ahh, I'm sorry I was reading some stuff wrong. I got confused. This should be very helpful then.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.