Skip to content

Commit

Permalink
Faster queries on large collections by removing default order.
Browse files Browse the repository at this point in the history
  • Loading branch information
TCB13 committed Sep 4, 2019
1 parent 5f82dda commit bbd0112
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class QueryBuilder
private $limit = 0;
private $skip = 0;
private $count = [];
private $order = ["_id" => 1];
private $order = [];
private $filters = [];
private $lookup = [];
private $unwind = [];
Expand Down Expand Up @@ -131,7 +131,7 @@ public function findAll(): self
];
}

if (!is_object($this->customPipeline) || empty($this->customPipeline->pipeline)) {
if (!empty($this->order) && (!is_object($this->customPipeline) || empty($this->customPipeline->pipeline))) {
$pipeline[] = ["\$sort" => $this->order];
}

Expand Down

0 comments on commit bbd0112

Please sign in to comment.