diff --git a/extensions/mongo/Collection.php b/extensions/mongo/Collection.php index 1de370e..6e1fe3c 100644 --- a/extensions/mongo/Collection.php +++ b/extensions/mongo/Collection.php @@ -253,7 +253,7 @@ class Collection extends Object $result[] = $actualValue; } else { $key = $this->normalizeConditionKeyword($key); - if (strncmp('$', $key, 1) !== 0 && array_key_exists(0, $actualValue)) { + if (strncmp('$', $key, 1) !== 0 && is_array($actualValue) && array_key_exists(0, $actualValue)) { // shortcut for IN condition $result[$key]['$in'] = $actualValue; } else { diff --git a/extensions/mongo/Query.php b/extensions/mongo/Query.php index 75bea4e..e8f3416 100644 --- a/extensions/mongo/Query.php +++ b/extensions/mongo/Query.php @@ -123,9 +123,10 @@ class Query extends Component implements QueryInterface */ protected function buildCursor($db = null) { - $where = $this->where; - if (!is_array($where)) { + if ($this->where === null) { $where = []; + } else { + $where = $this->where; } $selectFields = []; if (!empty($this->select)) {