I have a nested Document which have some language dependent content and I want to search if content have data for specific language and query should return me content else false.
I tried this query option
$data = $collection->findOne(array('original'=>'What is this', 'translation.language'=>'english') );
I am expecting this result:
{
"language": "english",
"quote": "What is this"
}
but above query return both language content. Can anyone please share some code also regarding saving and updating data using PHP
My collection:
{
"_id": ObjectId("56a8844bc56760810e483815"),
"language": "english",
"original_key": "What is this",
"translation": [
{
"language": "english",
"quote": "What is this"
},
{
"language": "spanish",
"quote": "What is this Spanish"
}
]
}