News for hackers. Stuff that matters.
Re:Nodejs and MongoDB, A Beginner's Approach by qF on Monday October 31, 2011 @07:20AM (#3177027)
This guide really shows what I think is a big problem with a lot of Node guides, they don't go beyond the first 5 minutes.

There are a ton of guides on how to set up a webserver in 20 lines, but hardly any on how to (properly) handle a lot of async callbacks and requests etc.

Re:Nodejs and MongoDB, A Beginner's Approach by dpapathanasiou on Monday October 31, 2011 @09:32AM (#3177284)
I've written about how to use callbacks in this context: http://denis.papathanasiou.org/?p=704
Re:Nodejs and MongoDB, A Beginner's Approach by ksetyadi on Monday October 31, 2011 @07:54AM (#3177088)
It's hard to cover many aspects of it when we talked about getting our feet wet. I try to include as few terms as possible that potentially confused people to start coding Nodejs-MongoDB. It's probably a big problem when you try to get your feet wet on the first day you learn about swimming just by jumping all over the pool. But then, hopefully, we learn.

Thanks for your opinion :)

Re:Nodejs and MongoDB, A Beginner's Approach by hello_moto on Monday October 31, 2011 @12:34PM (#3177976)
I'm not sure that both Node.js and MongoDB appeal beginners.

These 2 tools are reserved for people who exactly know what they want out of their tools, not for someone who just jumped in to "web development" and wanted to use buzzword compliant tools.

Sorry for being such a snippy on Monday morning but I'm hoping people around me would become better at fundamental as opposed to combining tools w/o knowing what they're good for.

Re:Nodejs and MongoDB, A Beginner's Approach by mcantelon on Monday October 31, 2011 @01:37PM (#3178242)
Why is MongoDB unsuitable for beginners? If beginners have a handle on Javascript it saves them from having to learn SQL and know any MySQL admin.
Re:Nodejs and MongoDB, A Beginner's Approach by hello_moto on Monday October 31, 2011 @04:03PM (#3178785)
... and this is a good thing? as opposed to learn proper RDBMS first and learn the lingo of NoSQL (document vs key-value vs column-oriented)?

But I digress, people have different experience. I've seen projects got burned many times by beginners who have lacked of understanding of RDBMS and you may have entirely different experience where your project shines because of MongoDB.

Re:Nodejs and MongoDB, A Beginner's Approach by ksetyadi on Monday October 31, 2011 @12:51PM (#3178054)
I've pointed it in the first three paragraphs. No worries for being snippy. In fact, you aren't :)
Re:Nodejs and MongoDB, A Beginner's Approach by mcantelon on Monday October 31, 2011 @01:39PM (#3178249)
Going into how to handle a lot of async callbacks/requests would be entirely different subject matter, would it not? The blog post is titled "Nodejs and MongoDB, A Beginner’s Approach" and that's the subject matter it tackles.
Re:Nodejs and MongoDB, A Beginner's Approach by Finbarr on Monday October 31, 2011 @11:05AM (#3177588)
Agree with this. Was disappointed the guide didn't delve into asynchronous even at a basic level. This is what makes nodejs and mongodb worth using and I don't think the concepts are overly difficult to grasp.
Re:Nodejs and MongoDB, A Beginner's Approach by Srirangan on Monday October 31, 2011 @11:19AM (#3177655)
To be honest, a good attempt by the author but I wouldn't recommend this to a beginner. Why? I don't recommend the use of the native driver - you end up with needlessly complex code.

I don't want to criticize the authors work. He's done a pretty good and thorough job. Hopefully I'll pen down an easier guide later tonight.

Re:Nodejs and MongoDB, A Beginner's Approach by mcantelon on Monday October 31, 2011 @01:42PM (#3178264)
Yeah, I'd say many folks will probably end up wanting to use something like Mongoose to abstract the nitty-gritty details of Node/MongoDB interaction, but knowing how to use the underlying library (and node-mongodb-native is the most popular of them by far) is healthy for beginners.
Re:Nodejs and MongoDB, A Beginner's Approach by ksetyadi on Monday October 31, 2011 @11:50AM (#3177783)
It's always nice to have another point of view within a subject. Would like to know more.
Re:Nodejs and MongoDB, A Beginner's Approach by stottc on Monday October 31, 2011 @06:10AM (#3176911)
There's something incredibly natural about node & mongo together.
Re:Nodejs and MongoDB, A Beginner's Approach by frou_dh on Monday October 31, 2011 @07:20AM (#3177029)
They're both Web Scale
Re:Nodejs and MongoDB, A Beginner's Approach by Luyt on Monday October 31, 2011 @08:18AM (#3177134)
Re:Nodejs and MongoDB, A Beginner's Approach by dextorious on Monday October 31, 2011 @10:15AM (#3177418)
Actually it's more like: hey, let's take two tools that ought to be used with utmost caution by people who know what they're doing and why they need them, and present them as the best thing since sliced bread.

The huge majority of uses for either would be better served without them.

Re:Nodejs and MongoDB, A Beginner's Approach by stottc on Monday October 31, 2011 @01:43PM (#3178267)
Our team's been using node/mongo in production for nearly a year now - on large social games.

The win on engineering productivity alone has made them a good choice for us.

Re:Nodejs and MongoDB, A Beginner's Approach by trafficlight on Monday October 31, 2011 @11:32AM (#3177711)
Why such an elitest attitude? We all have to start somewhere.
Re:Nodejs and MongoDB, A Beginner's Approach by dextorious on Tuesday November 01, 2011 @12:17PM (#3182766)
What elitist attitude? Agree, we all have to start somewhere, and the basics --a relational DB and a synchronous framework are fine somewheres to start from.

Now, when (and if) you know enough about those, by all means move on to NoSQL etc.

Note, though, that I'm taking about people using it in production and not knowing what the compromises are --the "Mongo DB is webscale" and "node.js is damn fast" people.

I have no problem with people that are just using it to play/experiment with (though, they too would have to understand the compromises eventually).

Re:Nodejs and MongoDB, A Beginner's Approach by trafficlight on Tuesday November 01, 2011 @01:02PM (#3182992)
What does it matter to you if they use it in production? It's not like your house is going to burn down.
Re:Nodejs and MongoDB, A Beginner's Approach by dextorious on Wednesday November 02, 2011 @05:48AM (#3185985)
Huh? Things should only matter to us when they affect us personally? Caring for the state of technology and development in general is prohibited?
Re:Nodejs and MongoDB, A Beginner's Approach by wavephorm on Monday October 31, 2011 @11:18AM (#3177647)
Mongo is excellent but I'd argue that Node and CouchDB is even a better fit because there's not even a driver involved, it's one HTTP request which just calls another.
Re:Nodejs and MongoDB, A Beginner's Approach by olegp on Monday October 31, 2011 @12:24PM (#3177935)
On a related note, I'm working on a synchronous narwhal-mongodb compatible driver that would work with common-node (http://olegp.github.com/common-node/), Would anyone be interested in helping out?
Re:Nodejs and MongoDB, A Beginner's Approach by senko on Monday October 31, 2011 @07:09AM (#3177009)
I'm both Node and MongoDB user and like them, but this can get really messy when there's a chain of callbacks involved, eg when you need a sequence of results but want to do it in a asynchronous fashion.
Re:Nodejs and MongoDB, A Beginner's Approach by beyondkaoru on Monday October 31, 2011 @09:15AM (#3177247)
I've been using this:

https://github.com/creationix/step

While I wouldn't quite call it pretty, it keeps things at the same indentation level, and I can still use closures to maintain the illusion of a single "thread".

Re:Nodejs and MongoDB, A Beginner's Approach by latch on Monday October 31, 2011 @07:12AM (#3177015)
Is that specific to MongoDB on node, or is that just generally true of node.js code though?
Re:Nodejs and MongoDB, A Beginner's Approach by patrickod on Monday October 31, 2011 @07:42AM (#3177064)
It's a problem with writing asynchronous code when you have lots of consecutive requests. I don't know if node has something like this but the Tornado team have written http://www.tornadoweb.org/documentation/gen.html which can make such things a little easier
Re:Nodejs and MongoDB, A Beginner's Approach by senko on Monday October 31, 2011 @07:33AM (#3177048)
It's generally true for Node when you have a lot of chained I/O. You can somewhat avoid it using events (so you set up event listeners instead of just chaining callbacks endlessly). So far I haven't seen any MongoDB module for Node taking advantage of those (haven't looked a lot yet, though).
Re:Nodejs and MongoDB, A Beginner's Approach by viscanti on Monday October 31, 2011 @09:43AM (#3177317)
I've used EventEmitter on a couple toy projects, but I've always assumed that's adding a bit more overhead to everything than just using callbacks. It's easier to read though and probably easier for someone else to figure out in the future. I've played with node.js libraries that have callbacks strung out over several files, so tracking down exactly where some behavior is happening isn't easy.

There are a few examples out there about using events/listeners, but I think there's room for a really good one.

Re:Nodejs and MongoDB, A Beginner's Approach by ksetyadi on Monday October 31, 2011 @07:43AM (#3177067)
Using event instead of callback to sequentially get the results with asynchronous way it's a potentially good idea. I also haven't learn much about another Nodejs-MongoDB libraries except the one what I have mentioned there. Please share if you have a follow-up on this technique.
Re:Nodejs and MongoDB, A Beginner's Approach by mcantelon on Monday October 31, 2011 @01:44PM (#3178272)
Mongoose is pretty good for succinct Node/MongoDB interaction.
Re:Nodejs and MongoDB, A Beginner's Approach by tista on Monday October 31, 2011 @08:24AM (#3177143)
Async behaviors would be a great read up for your next article :D
Re:Nodejs and MongoDB, A Beginner's Approach by latch on Monday October 31, 2011 @06:48AM (#3176971)
site seems to be having load issues.

Mirror: https://gist.github.com/1327266