Skip to content

Commit

Permalink
support sort in exists method
Browse files Browse the repository at this point in the history
  • Loading branch information
ziaratban committed May 11, 2024
1 parent d88e875 commit a4ae20e
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,14 @@ public function exists($db = null)
* https://blog.serverdensity.com/checking-if-a-document-exists-mongodb-slow-findone-vs-find/
*/
#save last options
$tmpOrderBy = $this->orderBy;
$tmpLimit = $this->limit;
$tmpOffset = $this->offset;
$tmpSelect = $this->select;
$this->orderBy = [];
$this->limit = 1;
$this->offset = null;
$this->select = ['_id'];
$cursor = $this->buildCursor($db);
#return last options
$this->orderBy = $tmpOrderBy;
$this->limit = $tmpLimit;
$this->offset = $tmpOffset;
$this->select = $tmpSelect;
Expand Down

0 comments on commit a4ae20e

Please sign in to comment.