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



我把mongo复制到我的Mac上。所以对于5.2和5.4mongoCollection没有聚合方法!!!!我在我的aws上测试了相同的php,它在那里工作

我试过var_dump(get_class_methods('MongoCollection'));在我的本地:

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)`

和在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" }

当我在终端(本地)使用聚合时,它工作

MongoCollection::aggregate (PECL mongo>=1.3.0)

因此-您在aws上使用驱动程序版本>= 1.3.0,并且<1.3.0在你的mac.

请注意,聚合是在monogoDB版本2.2中引入的

相关内容

  • 没有找到相关文章

最新更新