【发布时间】:2014-08-02 00:44:05
【问题描述】:
我们可以使用$push(将元素添加到数组中)更新到atomically update 包含数组的单个文档
但是,我找不到将add a new key 原子地映射到文档中的地图的方法。
我可以
* read the document,
* read the map in it,
* update the map in my code and
* update the document in my code.
但这不是原子的。
我只处理single document,但该文档有一张地图。
有没有办法可以自动更新(add a new key) 地图?
【问题讨论】:
标签: mongodb mongodb-query