From the documentation I read you can do this:
db.people.update( { name:"Joe" }, { $set: { n : 1 } } );
( http://www.mongodb.org/display/DOCS/Updating )
Now I would like to set it to a dynamic value like a counter or expression:
var i = 0;
db.people.update( { name:"Joe" }, { $set: { n : $i++ } } );
db.people.update( { name:"Joe" }, { $set: { n : ${new Date()} } } );
Is this possible ?
I would also accept any solution that does not need to modify and save the full document.
$incdoes? the examples you gave doesn't make much/any sense