我将 mongo 放在我的 Mac 上,使用 mongo.so 复制 5.2 和 5.4 mongoCollection 没有聚合方法!!!!我在我的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" }
当我在终端(本地)上使用聚合时,它可以工作
看起来很奇怪,任何想法都值得赞赏。