Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
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
PSDI Army
yii2
Commits
10bdd6b8
Commit
10bdd6b8
authored
Dec 03, 2013
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Method "execute()" added to Mongo Database.
parent
96e794b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
Database.php
extensions/mongo/Database.php
+12
-0
DatabaseTest.php
tests/unit/extensions/mongo/DatabaseTest.php
+13
-0
No files found.
extensions/mongo/Database.php
View file @
10bdd6b8
...
...
@@ -75,4 +75,15 @@ class Database extends Object
{
return
$this
->
mongoDb
->
createCollection
(
$name
,
$options
);
}
/**
* Executes Mongo command.
* @param array $command command specification.
* @param array $options options in format: "name" => "value"
* @return array database response.
*/
public
function
execute
(
$command
,
$options
=
[])
{
return
$this
->
mongoDb
->
command
(
$command
,
$options
);
}
}
\ No newline at end of file
tests/unit/extensions/mongo/DatabaseTest.php
View file @
10bdd6b8
...
...
@@ -31,4 +31,16 @@ class DatabaseTest extends MongoTestCase
$collectionRefreshed
=
$database
->
getCollection
(
'customer'
,
true
);
$this
->
assertFalse
(
$collection
===
$collectionRefreshed
);
}
public
function
testCommand
()
{
$database
=
$connection
=
$this
->
getConnection
()
->
getDatabase
();
$result
=
$database
->
execute
([
'distinct'
=>
'customer'
,
'key'
=>
'name'
]);
$this
->
assertTrue
(
array_key_exists
(
'ok'
,
$result
));
$this
->
assertTrue
(
array_key_exists
(
'values'
,
$result
));
}
}
\ 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