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
b910676c
Commit
b910676c
authored
Aug 15, 2013
by
Jens Segers
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Access to interal collection object, fixes #19
parent
5c438b18
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
README.md
README.md
+4
-0
Builder.php
src/Jenssegers/Mongodb/Builder.php
+3
-1
QueryTest.php
tests/QueryTest.php
+3
-0
No files found.
README.md
View file @
b910676c
...
...
@@ -237,6 +237,10 @@ You can also perform raw expressions on the internal MongoCollection object, not
return $collection->find();
});
Or you can access the internal object directly:
User::raw()->find();
**Query Caching**
You may easily cache the results of a query using the remember method:
...
...
src/Jenssegers/Mongodb/Builder.php
View file @
b910676c
...
...
@@ -410,12 +410,14 @@ class Builder extends \Illuminate\Database\Query\Builder {
* @param closure $expression
* @return mixed
*/
public
function
raw
(
$expression
)
public
function
raw
(
$expression
=
null
)
{
if
(
$expression
instanceof
Closure
)
{
return
call_user_func
(
$expression
,
$this
->
collection
);
}
return
$this
->
collection
;
}
/**
...
...
tests/QueryTest.php
View file @
b910676c
...
...
@@ -96,6 +96,9 @@ class QueryTest extends PHPUnit_Framework_TestCase {
$this
->
assertInstanceOf
(
'MongoCursor'
,
$cursor
);
$this
->
assertEquals
(
1
,
$cursor
->
count
());
$collection
=
DB
::
collection
(
'users'
)
->
raw
();
$this
->
assertInstanceOf
(
'MongoCollection'
,
$collection
);
}
}
\ No newline at end of file
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