开发者

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 } }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜