Building a MongoDB-based Queue
Matt Insler shows how to build a MongoDB-based queue using the server-side javascript and findAndModify command, using it to replace usage of Amazon SQS in his application:
I have been using MongoDB for a while now and am enamored with what it can do. I know that it can store lots of schema-less data in 4MB chunks (a document is limited to 4MB) and can store larger files through the use of GridFS. I know that it’s lightning fast (almost memcached speed) for indexed lookups and can handle thousands of operations per second without spiking the CPU over 10% even. I know that I’m paying for the CPU and hard drive space on Amazon EC2 already and thoroughly enjoy minimizing my monthly, weekly, and even daily costs. Blah. Blah. Blah. I want to implement this in Mongo!
But make no mistake: this approach just replaced a reliable, highly scalable, hosted (i.e. involving no operational costs) with a solution that misses all these.
via: http://www.mattinsler.com/why-and-how-i-replaced-amazon-sqs-with-mongodb/