title: Server side loop in mongodb to poll queue
body: <p>I'd like top use MongoDB to handle my queue (instead of AWS SQS I use right now) and I'm going to follow <a href="http://www.mattinsler.com/why-and-how-i-replaced-amazon-sqs-with-mongodb/" rel="nofollow">http://www.mattinsler.com/why-and-how-i-replaced-amazon-sqs-with-mongodb/</a></p>
  
  <p>In both cases (sqs and mongodb) I need a process with a while(true) that polls the queue. In my current configuration (.Net on the cloud) I have to pay for an additional worker role on Azure.</p>
  
  <p>The idea/question is: would it be possible to install a simple js script server side on mongodb that while(true) polls queue (->check for new doc in the db) and fire an http post if found?</p>
  
  <p>Are infinite loop as server side js on mongodb "allowed"? Any comments? Bonus? Malus? </p>