I'm using laravel-mongoDB how can I search in attraction and blog titles and only retrieve the object, not whole record. I've tried
[
'$match' => [
"attraction.title" =>
['$regex' => '.*' . $request- >search . '.*']
],
],
result was whole record. for example if search is first, output should be :
[{title: "first attraction", complete: false},{title: "first blog", complete: false}]
and this is records
[attraction: [{title: "first attraction", complete: false}, {title:"second attraction",
complete: true}]
blog: [{title: "first blog", complete: false}, {title: "second blog", complete: false}]
title: "test"
type: "internal"]