From 5379fd18bae141e724529d1e7ae3b37af87ed05d Mon Sep 17 00:00:00 2001 From: Sammaye Date: Mon, 1 Jul 2013 10:53:49 +0100 Subject: [PATCH] Fixed: https://github.com/Sammaye/MongoYii/issues/96 --- EMongoCriteria.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/EMongoCriteria.php b/EMongoCriteria.php index 495b3bc..3d67b8c 100644 --- a/EMongoCriteria.php +++ b/EMongoCriteria.php @@ -149,7 +149,9 @@ public function compare($column, $value = null, $partialMatch = false) { if ($value===null) return $this; $query = array(); - if (preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/', $value, $matches)) { + if(is_array($value)||is_object($value)){ + $query[$column]=array('$in'=>$value); + }elseif(preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/', $value, $matches)) { $value = $matches[2]; $op = $matches[1]; if ($partialMatch===true)