I have two documents and want to join both bocuments and after I want to fetch the data from merged table.
e.g below is the master document
{
"_id" : ObjectId("5d11bab64d51f58dbbd391lm"),
"title" : "Test test",
"test_url" : "https://www.example.com/",
}
and this one is detail document
{
"_id" : ObjectId("5d1360536d94f726ec484426"),
"master_id" : ObjectId("5d11bab64d51f58dbbd391lm"),
"title" : "जेल में असलहा लहाराते हुए बदमाशों का वीडियो वायरल, गृह विभाग ने दी सफाई",
"description" : "जिला कारागार में अपराधियों द्वारा असलहा लहराते हुए वीडियो सामने आया है।िला कारागार में अपराधियों द्वारा असलहा लहराते हुए वीडियो सामने आया है।िला कारागार में अपराधियों द्वारा असलहा लहराते हुए वीडियो सामने आया है।"
}
both documents are linked with _id of master document and master_id. I want to join that table and want to add title in detail document.
and after result I want to add query for search the data from merged document. below is the query for search.
$queryString = ".*".$queryString.".*";
$where = array(
'$or' => array(
array(
'title' => new \MongoDB\BSON\Regex($queryString),
),
array(
'description' => new \MongoDB\BSON\Regex($queryString),
),
)
);