Recently I've been doing a lot of work with MongoDB, an I've definitely been enjoying it! I work primarily in NodeJS and front-end JavaScript, and the reason why I love mongo so much is that you can basically just take an object and drop it directly into your database! Then when you read the value, it's already nicely in an object for you! As I've said many times before, every front-end application is just an interactive reflection of the data, and as we know from using Redux the data can be represented as one massive object outside of your components. JavaScript's collections are inherently very simple- it's either an array of a key-value pair, and that's exactly how you can save your data in Mongo as well. The old relational databases would give me such a headache as you would always have to map your objects back and forth between JSON and the table structure that resembled a "Microsoft Excel Spreadsheet". I guess it's easy to look at the data in an admin view (ie MySQL Workbench or something like that), but it kind of sucks to work with from the code because JavaScript doesn't store data in rows and columns. Not being able to nest properties forces you to do all these wacky table-joining aerobics, and not having internally recognized "Date" types would screw with sorting. Relational database are outdated, and imo there are very few JavaScript applications whose data would be better modeled in Postgres tables than Mongo (would love to be criticized for this in the comments lol). Finally, I just want to point out that it took me a while to really get into Mongo because I had heard some horror stories about people losing data or it being slow or whatever. While some of those stories are definitely true, a ton of development time has gone into fixing those issues, and nowadays if you are experiences bad things then it's most likely just you doing it wrong. haha. With that said though I feel like Mongo does make it very easy to do some obnoxiously heavy query and shoot yourself in the foot, but maybe that's just a consequence of the flexibility and power available to you. The other great thing is that there are a ton of other people using Mongo right now so almost any issue you have can just be googled to find other people also experiencing that issue and stack overflow answers that will hopefully get you past the stumbling point. Let me know how you feel about Mongo and other object-based databases in the comments below!
0 Comments
Your comment will be posted after it is approved.
Leave a Reply. |
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
March 2023
|