gpt4 book ai didi

子文档的 MongoDB 投影

转载 作者:IT老高 更新时间:2023-10-28 13:13:15 27 4
gpt4 key购买 nike

如何使用 MongoDB 查询预测作者的名字

{
name: "Wings Of Fire",
author:
{
first: "Abdul",
last: "Kalam"
}
}

最佳答案

您可以使用 dot notation在字段选择器中项目子文档字段。在外壳中:

db.test.find({}, {'author.first': 1})

关于子文档的 MongoDB 投影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15078840/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com