教你个办法,报错的是一个函数,你在报错的地方打印数据,比对一下两个接口(一个正确,一个错误)调用的数据有什么不同,然后分析一下。
{"name":"MongoDB Exception","message":"the $sort key specification must be an object","code":15973,"type":"yii\\mongodb\\Exception","file":"/mnt/hgfs/mywww/zl-mark/server/fecshop/vendor/yiisoft/yii2-mongodb/src/Command.php","line":192,"stack-trace":["#0 /mnt/hgfs/mywww/zl-mark/server/fecshop/vendor/yiisoft/yii2-mongodb/src/Command.php(739): yii\\mongodb\\Command->execute()",
"#1 /mnt/hgfs/mywww/zl-mark/server/fecshop/vendor/yiisoft/yii2-mongodb/src/Collection.php(370): yii\\mongodb\\Command->aggregate('product_flat', Array, Array)"