Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laravel-mongodb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
laravel-mongodb
Commits
d1883777
Commit
d1883777
authored
May 03, 2015
by
Jens Segers
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #406 from bonroyage/master
Added cursor hint
parents
e6ad623f
7b02af30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
Builder.php
src/Jenssegers/Mongodb/Query/Builder.php
+22
-1
No files found.
src/Jenssegers/Mongodb/Query/Builder.php
View file @
d1883777
...
...
@@ -28,6 +28,13 @@ class Builder extends BaseBuilder {
* @var int
*/
public
$timeout
;
/**
* The cursor hint value.
*
* @var int
*/
public
$hint
;
/**
* Indicate if we are executing a pagination query.
...
...
@@ -103,6 +110,19 @@ class Builder extends BaseBuilder {
return
$this
;
}
/**
* Set the cursor hint.
*
* @param mixed $index
* @return $this
*/
public
function
hint
(
$index
)
{
$this
->
hint
=
$index
;
return
$this
;
}
/**
* Execute a query for a single record by ID.
...
...
@@ -266,11 +286,12 @@ class Builder extends BaseBuilder {
// Execute query and get MongoCursor
$cursor
=
$this
->
collection
->
find
(
$wheres
,
$columns
);
// Apply order, offset
and limi
t
// Apply order, offset
, limit and hin
t
if
(
$this
->
timeout
)
$cursor
->
timeout
(
$this
->
timeout
);
if
(
$this
->
orders
)
$cursor
->
sort
(
$this
->
orders
);
if
(
$this
->
offset
)
$cursor
->
skip
(
$this
->
offset
);
if
(
$this
->
limit
)
$cursor
->
limit
(
$this
->
limit
);
if
(
$this
->
hint
)
$cursor
->
hint
(
$this
->
hint
);
// Return results as an array with numeric keys
return
iterator_to_array
(
$cursor
,
false
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment