We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22602c1 commit 8b1efe5Copy full SHA for 8b1efe5
src/Query.php
@@ -495,7 +495,24 @@ public function exists($db = null)
495
if (!empty($this->emulateExecution)) {
496
return false;
497
}
498
+
499
+ #better performance
500
+ #save last options
501
+ $tmpOrderBy = $this->orderBy;
502
+ $tmpLimit = $this->limit;
503
+ $tmpOffset = $this->offset;
504
+ $tmpSelect = $this->select;
505
+ $this->orderBy = [];
506
+ $this->limit = 1;
507
+ $this->offset = null;
508
+ $this->select = ['_id'];
509
$cursor = $this->buildCursor($db);
510
+ #return last options
511
+ $this->orderBy = $tmpOrderBy;
512
+ $this->limit = $tmpLimit;
513
+ $this->offset = $tmpOffset;
514
+ $this->select = $tmpSelect;
515
516
foreach ($cursor as $row) {
517
return true;
518
0 commit comments