Skip to content

Commit

Permalink
修复数据库类型为mongodb无查询条件时查询不到数据
Browse files Browse the repository at this point in the history
如下查询:Db::name('table')->order('id', 'DESC')->find();
mongodb调用order()方法时不会设置$this->options['order']字段,而是设置$this->options['sort']字段,导致查询失败直接返回[]。
  • Loading branch information
Arisasa committed Apr 19, 2024
1 parent e35f497 commit f3b9f15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/db/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ public function find($data = null)
$this->parsePkWhere($data);
}

if (empty($this->options['where']) && empty($this->options['order'])) {
if (empty($this->options['where']) && empty($this->options['order']) && empty($this->options['sort'])) {
$result = [];
} else {
$result = $this->connection->find($this);
Expand Down

0 comments on commit f3b9f15

Please sign in to comment.