gpt4 book ai didi

arrays - 在 MongoDB 的数组数据中查找数组

转载 作者:可可西里 更新时间:2023-11-01 09:47:30 25 4
gpt4 key购买 nike

我想在此文档组中查找:

      "document": {
"groups": [
{
"id": "5ccd5f7f34f82b0e3315b2f6"
},
{
"id": "73b43unbfkfmdmddfdf84jjk"
}
]
}

包含我的一些查询数组组ID:

[ '5ccd5f7f34f82b0e3315b2f6',
'5cdeded7ace07216f5873b5d',
'5cdee5d114edac2cc00bb333' ]

最佳答案

一个简单的查找查询就足够了:

db.collection.find({ 'groups.id' : {$in : [ '5ccd5f7f34f82b0e3315b2f6',
'5cdeded7ace07216f5873b5d',
'5cdee5d114edac2cc00bb333' ] }})

关于arrays - 在 MongoDB 的数组数据中查找数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56197501/

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