如何从文档内部的文档中删除数据? MongoDB Java

时间:2018-10-25 23:16:56

标签: java mongodb

说我的文件是

Document doc = new Document("name", "Test")
.append("type", "database")
.append("count", 1)
.append("info", new Document("a", 23).append("b", 12).append("c", 30));`

在我的数据库内部。

现在,我希望从“信息”中删除"b",12。我将如何进行? db.collection.deleteOne()删除整个文档。我一直在查看https://docs.mongodb.com/v3.2/tutorial/remove-documents/#remove-only-one-document-that-matches-a-condition,但到目前为止,我还找不到删除单个数据的方法。

0 个答案:

没有答案
相关问题