title: What's the difference between findAndModify and update in MongoDB?
body: <p>I'm a little bit confused by the <code>findAndModify</code> method in MongoDB. What's the advantage of it over the <code>update</code> method? For me, it seems that it just returns the item first and then updates it. But why do I need to return the item first? I read the <strong><em>MongoDB: the definitive guide</em></strong> and it says that it is handy for manipulating queues and performing other operations that need get-and-set style atomicity. But I didn't understand how it achieves this. Can somebody explain this to me?</p>