Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 mongo 中取消了一个数组字段,但它的字段值为 null,
问题是,如何删除它!
喜欢这张图片http://i.stack.imgur.com/O2WiV.png
您可以使用该操作从数组中删除所有null元素。查看文档$pull
null
$pull
代码示例:
db.collecton.update({condition: "x"}, {$pull: {state: null}});