My document:
{
"_id" : ObjectId("5824a9472e94e0995d3b0f0c"),
"full_name" : "Kelly Denise Benavides",
"aliases" : [
"Kelly D Benavides",
"Kelly Benavides"
]
}
I am wanting to search the document and return the document if user enters 'Kelly D Benavides'. I have tried using:
$person = Person::where('aliases', 'Kelly D Benavides')->first();
I believe the correct way to do so is using elemMatch but not clear on the syntax. Any pointers?