Node.js, MongoDB, and you: an intro in parts
blog.mongohq.com
blog.mongohq.com
Why? I still can't get this out of my mind:
https://twitter.com/HackerNewsOnion/status/38257854706983731...
Also before anyone gets too serious with a reply, learn to laugh. Humility goes along way! I poke fun at Ruby/Rails all the time.
That said, if your project doesn't store extremely important data and needs to be quick to write Mongo's an OK choice.
Of course, even though it's much easier to use than other databases at first, if you later want to make sure your data doesn't disappear it's a total PITA.
I struggled with the concept of denormalisation, as I came from a hobbyist SQL background, but I managed to build a project based on Mongo and Node (https://rwt.to), and in the process I went from trying very hard to 'make joins work' to hitting the sweet spot of getting my data 'right'. Mongo certainly ain't meant for everything, and I don't know if they'll ever support joins.
The post/pre-save methods are pretty bad ass and there are a few things I still do like about mongo (which is why I chose to explore it initially), but I think for social type websites, a sql solution makes more sense. I also scoped @ http://www.rethinkdb.com/ which looked interesting, but at this time I wanted to go with a more bulletproof solution to my problems.
I really think Pg is starting to blow Mongo out of the water.
0 : https://github.com/tgriesser/knex 1 : https://github.com/tgriesser/bookshelf
For this, check out the fantastic node-postgres adapter from brianc as well as his node-sql package for authoring SQL statements.
https://github.com/brianc/node-postgres https://github.com/brianc/node-sql
Supports joins out of the box, and has much saner locking. It is in its infancy still, but I believe are coming out with a LTS release shortly.
Also, it's just fun to work with.
This is acknowledged by 10gen/MongoDB inc: https://groups.google.com/forum/#!topic/node-mongodb-native/...
Use the beta 1.3 driver until 1.4 comes out unless you want to tear your hair out.
Seriously, just learn it. Get your --harmony flag on. It will be in browsers soon enough as well. It's literally the future of javascript and having converted some of my codebase to promises + generators instead of just promises. Wow. It felt amazing. Suddenly everything doesn't look like spaghetti.
I use bluebird for promises and a custom dev fork of Coffeescript that allows for generators. You do have to wrap your anonymous functions with "Promise.coroutine", but thats really it. You could always just not even use promises, and go plain generators too.