public function matchDocument($doc, $field, $operator, $value)
{
$docVal = $this->getFieldValue($doc, $field, $found);
if (!$found) {
return false;
}
switch (true) {
case $operator === '==' && $docVal == $value:
return true;
case $operator === '===' && $docVal === $value:
return true;
case $operator === '!=' && $docVal != $value:
return true;
case $operator === '!==' && $docVal !== $value:
return true;
case $operator === '>' && $docVal > $value:
return true;
case $operator === '>=' && $docVal >= $value:
return true;
case $operator === '<' && $docVal < $value:
return true;
case $operator === '>=' && $docVal >= $value:
return true;
case $operator === 'IN' && in_array($docVal, (array) $value):
return true;
}
return false;
}