简体   繁体   English

致命错误:调用未定义的函数aggregate()

[英]Fatal error: Call to undefined function aggregate()

I put mongo on my Mac using copying mongo.so for both 5.2 and 5.4 mongoCollection doesnt have aggregate method!!!! 我使用复制mongo.so将Mongo放在Mac上,用于5.2和5.4 mongoCollection没有聚合方法! I tested the same php on my aws and that works there 我在我的aws上测试了相同的php,并且在那里工作

I tried var_dump(get_class_methods('MongoCollection')) ; 我尝试了var_dump(get_class_methods('MongoCollection')) ; and on my local: 在我的本地:

array (size=24)
0 => string '__construct' (length=11)
1 => string '__toString' (length=10)
2 => string '__get' (length=5)
3 => string 'getName' (length=7)
4 => string 'getSlaveOkay' (length=12)
5 => string 'setSlaveOkay' (length=12)
6 => string 'drop' (length=4)
7 => string 'validate' (length=8)
8 => string 'insert' (length=6)
9 => string 'batchInsert' (length=11)
10 => string 'update' (length=6)
11 => string 'remove' (length=6)
12 => string 'find' (length=4)
13 => string 'findOne' (length=7)
14 => string 'ensureIndex' (length=11)
15 => string 'deleteIndex' (length=11)
16 => string 'deleteIndexes' (length=13)
17 => string 'getIndexInfo' (length=12)
18 => string 'count' (length=5)
19 => string 'save' (length=4)
20 => string 'createDBRef' (length=11)
21 => string 'getDBRef' (length=8)
22 => string 'group' (length=5)
23 => string 'distinct' (length=8)`

and on aws: 在aws上:

array(28) { [0]=> string(11) "__construct" [1]=> string(10) "__toString" [2]=> string(5) "__get" [3]=> string(7) "getName" [4]=> string(12) "getSlaveOkay" [5]=> string(12) "setSlaveOkay" [6]=> string(17) "getReadPreference" [7]=> string(17) "setReadPreference" [8]=> string(4) "drop" [9]=> string(8) "validate" [10]=> string(6) "insert" [11]=> string(11) "batchInsert" [12]=> string(6) "update" [13]=> string(6) "remove" [14]=> string(4) "find" [15]=> string(7) "findOne" [16]=> string(13) "findAndModify" [17]=> string(11) "ensureIndex" [18]=> string(11) "deleteIndex" [19]=> string(13) "deleteIndexes" [20]=> string(12) "getIndexInfo" [21]=> string(5) "count" [22]=> string(4) "save" [23]=> string(11) "createDBRef" [24]=> string(8) "getDBRef" [25]=> string(5) "group" [26]=> string(8) "distinct" [27]=> string(9) "aggregate" }

when I use aggregate on terminal(local) it works 当我在终端(本地)上使用聚合时

seems very weird, any idea is appreciated. 看起来很奇怪,任何想法都值得赞赏。

MongoCollection::aggregate (PECL mongo >=1.3.0) MongoCollection :: aggregate(PECL mongo> = 1.3.0)

As such - you are using the driver version >= 1.3.0 on aws, and < 1.3.0 on your mac. 这样-您在aws上使用驱动程序版本> = 1.3.0,在Mac上使用<1.3.0。

Note that aggregation was introduced in monogoDB version 2.2 请注意, 聚合是在monogoDB 2.2版中引入的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM