Very much worth it to go through the book and it only takes an afternoon.
One thing that I immediately liked was the format of the find in the shell.
db.hits.update({page: 'unicorns'},{$inc: {hits: 1}}, {upsert:true});It just reminds me of groovy and passing and returning json. I compare that to something that might be written in traditional java, which seems so clumsy.
db.getHits().updateWithInc(String page, Integer inc, boolean upsert);
Where page, being a string we would have to be able to parse the string. Or pass an object. With groovy of course any object can just be flattened into JSON and rebuilt.
Far more flexibility, far simpler syntax.
No comments:
Post a Comment