我想在mongodb集合中搜索一个字符串,并且搜索字符串存在于另一个集合中,该集合作为当前集合中的对象数组连接。
示例集合 集合1:
_id:5ec6e9387bfec30017036b0d
mrthodType:"POST"
active:true
requestContentType:"JSON"
responseContentType:"JSON"
title:"Refund Amount"
usecase:"To refund amount."
slug:"refund-transaction"
requestHead:Array
0:Object
_id:5ec772da29bf5800177665dd
kind:"Collection2"
ref:5ec6e9387bfec30017036b0e
1:Object
2:Object
3:Object
4:Object
requestBody:Array
responseHead:Array
responseBody:Array
responseDetails:Array
endpoints:Array
codeSnippets:Array
responseCode:Array
seo:Array
createdAt:2020-05-21T20:48:56.715+00:00
updatedAt:2020-05-22T06:36:25.120+00:00
__v:1
收藏2:
_id:5ec6e9387bfec30017036b0e
requirement:"optional"
datatype:"string"
name:"version"
example:"**Example**: v1"
object:Array
createdAt:2020-05-21T20:48:56.932+00:00
updatedAt:2020-05-22T06:36:20.874+00:00
__v:0
parameter:5ec6e3934713700017f64fa4
我想搜索collection1,它也可以返回存在于collection2中的结果
例如:在搜索“版本”结果时,应返回collection1-> requestHead [0]