Answer the question
In order to leave comments, you need to log in
Where is the error in the MongoDB query?
Hello. I make a request, it seems to be correct, but update () does not work correctly
$update['modules.$.elements.$.html'] = 'ТЕСТ';
$result = Blocks::where([
'_id' => $block_id,
'modules' => [
'$elemMatch' => [
'module_id' => $module_id,
'elements' => [
'$elemMatch' => [
'element_id' => $element_id
]
]
]
]
])->update($update);
$update['modules.$.elements'] = 'ТЕСТ';
"_id": "1",
"modules" : [
{
"module_id" : "2",
"elements" : [
{
"element_id" : "3",
"html": "<div></div>"
}
]
}
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question