标题: php报错BSON field 'count.query' is the wrong type 'array', expected type 'obj... [打印本页] 作者: 匿名 时间: 2022-4-17 22:55 标题: php报错BSON field 'count.query' is the wrong type 'array', expected type 'obj... php报错BSON field 'count.query' is the wrong type 'array', expected type 'object'问题解决
Thinkphp在连接使用Mongodb的时候,做数据分页或者查询数据总数需要使用count()方法,出现报错信息:BSON field 'count.query' is the wrong type 'array', expected type 'object'。
报错原因:
在think-mongo版本,vendor/topthink/think-mongo/src/Builder.php文件中,parseWhere方法在做过滤条件初始化的时候,没有考虑周全,将数据类型定义为了数组。