I want to search a string in my mongodb collection, and the search string is present in another collection that is connected as an array of objects in my current collection.
example collection Collection 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
Collection 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
I want to make a search for collection1 that can return results present in collection2 also
For example: on searching 'version' result should return collection1->requestHead[0]