From 2ee7d19834f3d566579df33e8b86c8ee1d350238 Mon Sep 17 00:00:00 2001
From: colly_wyx <wangyixiong_007@163.com>
Date: Wed, 18 Apr 2018 11:20:05 +0800
Subject: [PATCH] 修正参数错误
---
Library/Mongo/Lite.php | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/Library/Mongo/Lite.php b/Library/Mongo/Lite.php
index b06990d..243b077 100644
--- a/Library/Mongo/Lite.php
+++ b/Library/Mongo/Lite.php
@@ -374,6 +374,21 @@
}
/**
+ * ������
+ * @param [type] $colName [description]
+ * @param [type] $params [description]
+ * @return [type] [description]
+ */
+ public function aggregate($colName, $params){
+ $col = $this->_getCol($colName);
+ // ������������ '_id' ������
+ //$query = $this->_parseId($query);
+ $result = $col->aggregate($params);
+
+ return $result['result'];
+ }
+
+ /**
* ���������������������
*
* @param string $colName ���������
@@ -543,7 +558,12 @@
// ���������������������'_id'������(���������������)
private function _parseId($arr){
if(isset($arr['_id'])){
- $arr['_id'] = new MongoId($arr['_id']);
+ try{
+ $arr['_id'] = new MongoId($arr['_id']);
+ }
+ catch(MongoException $ex){
+ die('���������������id');
+ }
}
return $arr;
}
--
Gitblit v1.8.0