Hi,
I’m running MongoDB 4.x with the extension for PHP8.
I have a document structure like this:
_id
account_id (int)
survey_id (int)
answers (array)
[0] (object)
answer
type
question
[1] ....
A few data snippet samples of the answers object
[doc 1] answer = 1
type = 12
[doc 2] answer = 2
type = 12
[doc 3] answer = 5
type = 12
[doc 4] answer = 1
type = 12
[doc 5] answer = 2
type = 12
My find filter array is:
Array
(
[account_id] => 1005
[survey_id] => 205244
[answers.type] => 12
[answers.answer] => 2
)
I expect to only get results where account_id = 1005 and survey_id=205244 and answers.type=12 and answers.answer=2
However, this returns results with 2 but also the results with 1 as answer.
I’m at it for a few hours now and I just don’t have any explanation why this happens.