The MEAN Stack: MongoDB, ExpressJS, AngularJS and Node.js
blog.mongodb.org
blog.mongodb.org
Postrgesql with no-sql extensions ( for when you may need flexibility), typed python or typescript or dart( or any language with optionnal typing) on the server, and typescripted js lib on the frontend I'd call it the Optional Typing Stack ( but ots isn't nearly as good as "mean" i must say).
Which really sums up the advantage of MongoDB to me - JSON is a more natural fit for domain objects than SQL tables.
And those are just the built-in ones, not counting PostGIS and other ones that you can define: http://www.postgresql.org/docs/9.1/static/extend-type-system...
Go have a look at the complex number implementation here: http://www.postgresql.org/docs/9.1/static/xtypes.html then come back and tell me that Postgres is "not a real programming language" (whatever that means these days).
This is not what the GP was talking about. You are adding in another client library to hopefully enforce the rules in that specific (nodejs) client.
I just noticed you said almost. Maybe this is the exceptional case you were thinking of :)
Most applications grow to the point that they have multiple database clients (it is a virtual inevitability).
Utilities that have to do something. Integration points. Etc.
In an ideal world these can all be completely tunneled through an API, but that is seldom the practice (different needs, different maintenance cycles, etc), whether in a RDBMS or a document model.
Above and beyond that, most applications see technical variations and evolutions of the things that contact it. Today you might be enamored with nodejs, tomorrow it's Go, and the next day it's noderust, etc. Having a technology-coupled surrogate for basic database functionality isn't a sustainable approach.
So you still have everything structured but not have to worry about annoying migrations.
Do you write bug free code 100% of the time? I'm pretty good, but I definitely don't. And when there are bugs in my code, I'm grateful for a RDBMS with enforced referential integrity.
I've also had to work on projects where the initial codebase was scrapped all together. When that's happened I've found having the data in clearly defined columns and relationships immensely useful.
And like many are doing these days I do all my joins in my app so that I have the flexibility of moving objects into more appropriate storage mediums e.g. Redis or Solr without major refactoring.
I am not dismissing the benefits of having business rules in the database only that they aren't always necessary.
And even then more and more systems are integrating via internal APIs or MQs rather than directly to the database.
That said, this is a very awesome stack to use for hackathons and short projects or prototypes.
Trying to repeat the trick by coming up with another cool acronym is not a good idea.
The problem with the LAMP stack is the idea that one stack is suitable for just about any purpose. So you get developers trying to build hugely complicated algorithms with 'if' and 'for' loops in PHP and turning MySQL into an object store with ORM.
Better to use the right tool for the job, rather than the one all the cool kids are using today, or the one with the best sounding name.
Will the MEAN stack stand the test of time? How many forgotten JS libraries litter the timeline of web development?
For browser side packages, sure, there's churn. But that's true of any web stack, and at the pace browsers develop, it's worthwhile revisiting those library choices more than once a year anyway.
20 765 downloads in the last day 127 921 downloads in the last week 489 285 downloads in the last month
Since it's essentially Sinatra for Node.js, I don't think it's too big of a stretch to say that it will be a part of the stack for some time.
I would say longer than Angular, as browser-side packages seem to have more churn on the basis of adoption of newer browser features.
The lead in seriously harms the technical credibility of the rest of the entry.
In some use cases, you have many transactions against a data store that won't be modified once it is set. In a case like that, mongodb is acceptable.
In other use cases, you have more complicated transactions involving lots of separate logical units. For example, lets say you are building an inventory and order management system. Someone wants to buy a widget. You need to reduce the widget inventory and push it into a customer's order, essentially an "Atomic" operation. AFAICT there's no "simple" data model under which MongoDB can give you atomicity.
In order to make a decision, the best bet is to figure out those requirements and just try one that fits the bill.
NoSQL, on the other hand, is weakly typed and makes few if any attempts to validate your data, pushing that responsibility back onto you. They are very well suited to storing inherently inconsistent data (which, as a corollary, makes them very good for prototyping, when your data model is rapidly changing and growing). They also allow you to link much larger datasets into a 'document' which is retrieved as a unit with no extra computation.
So it mostly boils down to what kind of data you want to store. If you find yourself almost exclusively saying things like "All users have a username that is a string" or "I want to be able to find all products that cost less than $20" then you're probably looking for a traditional SQL database. If, on the other hand, you find yourself saying "some products have a width and height, but some just have a height, and a few have a volume instead" or "I want to be able to add custom fields to products on the fly" or "I never want to see purchases on their own, I always want to see them joined to the user that bought them" then you should probably consider a NoSQL solution.
>NoSQL, on the other hand, is weakly typed and makes few if any attempts to validate your data, pushing that responsibility back onto you. They are very well suited to storing inherently inconsistent data
Actually, I've had to deal with that first hand. It gets particularly nasty when multiple languages with varying type-tightness interact with the same data.
It's nice to hear someone else put this into words.
Why does business have to be built on dishonesty?
People get burned when they assume honesty and find that counterparties are dishonest. It's harder to get burned if you go into business or other intellectual relationships without expecting honesty. And I think, push come to shove, many founders will do what is necessary (no matter how unscrupulous) to keep their startup alive or to ensure the big payday, even if it comes at the price of turning back on promises or contracts with customers
I recommend you read http://www.zerohedge.com/node/13972 (the Conflicts/"Full Disclosure" Policy for zerohedge.com) as I think it captures the point very well.
'If you honestly say: "This is good with <product>, this is bad with <product>".'
In order to evaluate the veracity of the claim, you have to try the product. And if you have to pay money to try the product to verify the claim, then it's unclear as to how many people will actually bother to verify. If you price it high enough that the number of people is zero, then you could say whatever you want without others knowing if you are being honest.
Author of the post here. Thanks for the excellent discussion, this is a very interesting read. Let me make a few comments re: some of the more interesting points I've read.
1) I love Redis, but in my book, if you're already using MongoDB, its more of a tool for reducing latencies once you're looking to scale. If I'm just looking to prototype I'll probably use one or the other, but not both. I love the MEANR / MEANER acronym though, but I can't support the EJS decision, I'm all about Jade =)
2) AngularJS not good for hackathons? Sounds like a subject for another post. Granted it may be that I'm just extremely biased towards Angular, I was an intern with the Google team that developed it in '08 and I've been using it since v0.9.9. However, I find Angular's slick two-way data-binding to be completely indispensable for building a prototype. There are two primary reasons for this, first I find the paradigm of writing Javascript which explicitly references the DOM to be brittle, and second it makes life easier for my designer because he never has to worry about breaking the frontend Javascript.
3) I agree that Javascript is a rapidly developing language and many of the tools that I use may well be obsolete within a few years. However, I think that I benefit from using the tools that I believe are best in the meantime, and when better tools are released, then we'll change along with them.
Thanks again for the commentary, I really appreciate it. I'll be coming out with a few more posts in the near future, please be on the lookout =)
But I don't see the point of using an ORM with MongoDB... not saying ORMs are bad, I just don't think they have much to offer when there is no SQL to abstract and when you're doing everything in JSON anyway (in this stack). If I'm missing something, happy to be enlightened.
As someone who spends each day switching between Erlang, Ruby, Javascript and sometimes C (with various infrastructure components also requiring bits of Java or Go) I find a the idea of a one-language stack sort of mindblowing (though I've always sort of fantasized about connecting my Erlang servers directly to an Erlang VM running in the browser over the distribution protocol.)
Would you mind expanding on those "huge benefits", as you've actually experienced them? I've only ever really seen people describing theoretical benefits they imagine they might see if they did this, but nothing from anyone who has.
I am definitely curious about other languages, but I don't have the inclination to spend the time to learn them well enough to build something I would put on the internet. At least not when I can put together a pretty performant / scalable app with a modicum of effort using this stack.
These things may not be of much significance to a seasoned polyglot dev, but for someone who only really knows JS and is an infrastructure guy by trade, it makes a big difference :)
MongoDB + Flask + Angular + Python
MongoDB + Play + Angular + ScalaThe meteor guys have implemented this logic in a package called minimongo: http://bit.ly/YmS3Y1
you could also use clojurescript serverside using node.js. this is what LightTable does iirc http://www.chris-granger.com/lighttable/
There's a CMS, for starters.