How can I update increment two fields in one command in MongoDB?
The documentation tells me this is legal if I want to set one value and 开发者_如何学Cincrement another:
{ $set : { x : 1 }, $inc : { y : 1 } }
What if I want increment both variables? I'm trying this but it isn't working:
{ $inc : [{ y : 1 }, { x : 1 }] }
Is this possible?
I'm an idiot:
{ $inc : { y : 1, x : 1 } }
精彩评论