When & Where Do You Use Mongo And Nodejs

lol no dude. id switch my dayjob to node in an instant if someone felt like paying for it...

i just want the web side to develop a bit more though.. played with pretty much all of them and they're just not ready yet imo

Not ready? Then why is paypal converting half there platform to it? http://krakenjs.com/, nodejs web side is more than ready.
 
haven't seen kraken.. played with meteor, tower and quite a few others and they just seemed a lot more fiddly than stacks like rails or asp.net

i tried to code devscore in tower before i switched back to mvc and i just couldn't get it right.. dunno. maybe it's a documentation thing. i found too many hello world examples and not enough actual projects i guess.

stackoverflow was deserted whenever problems arose and i spent too much time not getting stuff done.. bearing in mind this wasn't a full time experiment i gave it a month or two of a couple of hours a night
 
The ones you mentioned are crap, express is the true mvc one. Our platform is built on Kraken with a few modifications here and there.
 
also sem i don't think kraken existed when i was looking at node. earliest commit on their github repo is 3 months ago?

how long ago did you write your saas app?

We've been writing it for a few months, originally in express. So when kraken came out we migrated took us about a week.
 
nice. yeah i was already committed to asp by september

Yeah we started with asp, but decided to to switch before it was to late. We have a bizspark account but we decided we wanted to go the nodejs route, so that in future we wouldn't have some nasty licensing costs on our head.
 
i got a bizspark account and am worried about the licensing costs in 3 years time :)

They only really come into play when you start earning money on your app. And if all go's well with us we will see a substantial cashflow which i dont feel like handing over to MS:P
 
Whoa, gone for a little while and this thread blows up :P

@sp4ceman, I see your use case for nosql has been mainly on logging and that seems like an apt use case. Would you do something like save the data in sql and also as a document. The nosql database would then server your API. Do you think that would be plausible and a good use case?

@semaphore, youe use node for your app but what datastore are you using (a relational one I assume)? I see that there are many ORMs for node now. Which on are you using? How good is the intergration of the orm you are using? I'm sure it is non-blocking module...

Now, I'm by no means a nodejs expert and have many questions. One of which relates to the blocking of the event loop. At the end of the article, they guy basically parses a raw response to JSON. There it seems he could easily block the event loop. So, it seems it is pretty easy to block things and there is a fine line in which you have to tred carefully.

So, am I correct in saying that it is OK to develop a site using Nodejs with say PostgreSQL if the app/site is not heavy on computation. That could be implemented with a MQ and some other language...

EDIT:
Also, that means you could/would replace any content only driven site with node (blogs, cms, portals)?
 
Whoa, gone for a little while and this thread blows up :P

@sp4ceman, I see your use case for nosql has been mainly on logging and that seems like an apt use case. Would you do something like save the data in sql and also as a document. The nosql database would then server your API. Do you think that would be plausible and a good use case?

@semaphore, youe use node for your app but what datastore are you using (a relational one I assume)? I see that there are many ORMs for node now. Which on are you using? How good is the intergration of the orm you are using? I'm sure it is non-blocking module...

Now, I'm by no means a nodejs expert and have many questions. One of which relates to the blocking of the event loop. At the end of the article, they guy basically parses a raw response to JSON. There it seems he could easily block the event loop. So, it seems it is pretty easy to block things and there is a fine line in which you have to tred carefully.

So, am I correct in saying that it is OK to develop a site using Nodejs with say PostgreSQL if the app/site is not heavy on computation. That could be implemented with a MQ and some other language...

EDIT:
Also, that means you could/would replace any content only driven site with node (blogs, cms, portals)?

We use postgresql the orm we use is (http://sequelizejs.com/), the event loop is tricky and you can fall into call back hell, this type of programming model forces you to write modular code in a way.

Here is an example of postgresql querying / inserting (http://hueniverse.com/2011/06/the-style-of-non-blocking/).

We processing a lot of information in the background, our frontend is purely that. We ferry all intensive tasks to our rabbit node, which then distributes it to a node that is not under duress, once it reaches this node(compute node) it processes the task. Background tasks update the database and we have socket connections that check for updates and do real time updates on the ui ( we use standard socket.io, been thinking about moving to pusher.io, but have not seen the benefit for the cost yet.).

Not really sure what you asking in your last question:P
 
We use node-js a little differently, in the client side.

when I say in the client side I mean you can do this:

Code:
$("input").val(process.cwd());

that is not a real UC, we mostly use it for background processes, like async download/pause/resume of files to the user's harddrive.

obviously this doesnt run/work in a standard browser
 
Could I ask something?

1) When and why would you use nodejs as apposed to normal web applications with html, JS, and ajax?

2) Could I use it in conjunction with current web development like ajax, jquery, mvc?

Thanks
 
Could I ask something?

1) When and why would you use nodejs as apposed to normal web applications with html, JS, and ajax?

2) Could I use it in conjunction with current web development like ajax, jquery, mvc?

Thanks

1.) NodeJS allows you to build scalable web apps, it takes care of all incoming http requests. Your html/js/ajax does not.

2.) MVC is a paradigm not a language, Express is an MVC framework for nodejs, ajax is just a standard call to external resources, so yes.
 
1.) NodeJS allows you to build scalable web apps, it takes care of all incoming http requests. Your html/js/ajax does not.

Ah, so its a server side technology, now it makes sense. That JS in the name threw me.

Did some reading quick, reminds me very much of the older .NET IAsyncResult implementation for making asynchronous SOAP and WCF web services (very tedious), and the newer Async-Await in .NET 4.5 (very simple and easy).

Good stuff though, i like finding out new things :)
 
Ah, so its a server side technology, now it makes sense. That JS in the name threw me.

Did some reading quick, reminds me very much of the older .NET IAsyncResult implementation for making asynchronous SOAP and WCF web services (very tedious), and the newer Async-Await in .NET 4.5 (very simple and easy).

Good stuff though, i like finding out new things :)

To a degree yes, but its also non blocking so you don't have to deal with problems with multi-threading (which is inherently complex and not a lot of people understand properly), it forces you to make modular code (unless you fall into call back hell).

Example of hell:

Code:
var db = require("some-db-abstraction");

function handleWithdrawal(req,res){  
    try {
        var amount=req.param("amount");
        db.select("* from sessions where session_id=?",req.param("session_id"),function(err,sessiondata) {
            if (err) throw err;
            db.select("* from accounts where user_id=?",sessiondata.user_ID),function(err,accountdata) {
                if (err) throw err;
                    if (accountdata.balance < amount) throw new Error('insufficient funds');
                    db.execute("withdrawal(?,?),accountdata.ID,req.param("amount"), function(err,data) {
                        if (err) throw err;
                        res.write("withdrawal OK, amount: "+ req.param("amount"));
                        db.select("balance from accounts where account_id=?", accountdata.ID,function(err,balance) {
                            if (err) throw err;
                            res.end("your current balance is "  + balance.amount);
                        });
                    });
                });
            });
        }
        catch(err) {
            res.end("Withdrawal error: "  + err.message);
    }
 
To a degree yes, but its also non blocking so you don't have to deal with problems with multi-threading (which is inherently complex and not a lot of people understand properly), it forces you to make modular code (unless you fall into call back hell).

Multi-threading always separates the men from the boys :D:D:D

My introduction to multi-threading and blocking/non-blocking was when I had to write a program using Delphi's SocketServer way back in the day. Thinking about is, that was 12 years ago now. I miss that kind of programming sometimes.
 
Basically mongodb has greater performance than MySQL in large tables, we have had to start caching some mysql tables because queries can take minutes with millions of rows. Nodejs goes to mongo as php goes to mysql, but you can cross use. Mostly preference and app database size
 
Top
Sign up to the MyBroadband newsletter
X