Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
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
mongo-php-library
Commits
81477df2
Commit
81477df2
authored
Aug 26, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23
parents
ab3f0510
aa124d05
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
11 deletions
+11
-11
Count.php
src/Operation/Count.php
+1
-1
CreateIndexes.php
src/Operation/CreateIndexes.php
+1
-1
ListCollections.php
src/Operation/ListCollections.php
+2
-2
ListDatabases.php
src/Operation/ListDatabases.php
+1
-1
ListIndexes.php
src/Operation/ListIndexes.php
+2
-2
CollectionFunctionalTest.php
tests/Collection/CollectionFunctionalTest.php
+2
-2
FunctionalTestCase.php
tests/FunctionalTestCase.php
+2
-2
No files found.
src/Operation/Count.php
View file @
81477df2
...
@@ -85,7 +85,7 @@ class Count implements Executable
...
@@ -85,7 +85,7 @@ class Count implements Executable
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
());
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
());
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
$result
=
current
(
$cursor
->
toArray
());
$result
=
current
(
$cursor
->
toArray
());
if
(
empty
(
$result
[
'ok'
]))
{
if
(
empty
(
$result
[
'ok'
]))
{
...
...
src/Operation/CreateIndexes.php
View file @
81477df2
...
@@ -91,7 +91,7 @@ class CreateIndexes implements Executable
...
@@ -91,7 +91,7 @@ class CreateIndexes implements Executable
));
));
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$command
);
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$command
);
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
$result
=
current
(
$cursor
->
toArray
());
$result
=
current
(
$cursor
->
toArray
());
if
(
empty
(
$result
[
'ok'
]))
{
if
(
empty
(
$result
[
'ok'
]))
{
...
...
src/Operation/ListCollections.php
View file @
81477df2
...
@@ -85,7 +85,7 @@ class ListCollections implements Executable
...
@@ -85,7 +85,7 @@ class ListCollections implements Executable
}
}
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
return
new
CollectionInfoCommandIterator
(
$cursor
);
return
new
CollectionInfoCommandIterator
(
$cursor
);
}
}
...
@@ -115,7 +115,7 @@ class ListCollections implements Executable
...
@@ -115,7 +115,7 @@ class ListCollections implements Executable
:
array
();
:
array
();
$cursor
=
$server
->
executeQuery
(
$this
->
databaseName
.
'.system.namespaces'
,
new
Query
(
$filter
,
$options
));
$cursor
=
$server
->
executeQuery
(
$this
->
databaseName
.
'.system.namespaces'
,
new
Query
(
$filter
,
$options
));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
return
new
CollectionInfoLegacyIterator
(
$cursor
);
return
new
CollectionInfoLegacyIterator
(
$cursor
);
}
}
...
...
src/Operation/ListDatabases.php
View file @
81477df2
...
@@ -55,7 +55,7 @@ class ListDatabases implements Executable
...
@@ -55,7 +55,7 @@ class ListDatabases implements Executable
}
}
$cursor
=
$server
->
executeCommand
(
'admin'
,
new
Command
(
$cmd
));
$cursor
=
$server
->
executeCommand
(
'admin'
,
new
Command
(
$cmd
));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
$result
=
current
(
$cursor
->
toArray
());
$result
=
current
(
$cursor
->
toArray
());
if
(
empty
(
$result
[
'ok'
]))
{
if
(
empty
(
$result
[
'ok'
]))
{
...
...
src/Operation/ListIndexes.php
View file @
81477df2
...
@@ -76,7 +76,7 @@ class ListIndexes implements Executable
...
@@ -76,7 +76,7 @@ class ListIndexes implements Executable
}
}
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
return
new
IndexInfoIteratorIterator
(
$cursor
);
return
new
IndexInfoIteratorIterator
(
$cursor
);
}
}
...
@@ -97,7 +97,7 @@ class ListIndexes implements Executable
...
@@ -97,7 +97,7 @@ class ListIndexes implements Executable
:
array
();
:
array
();
$cursor
=
$server
->
executeQuery
(
$this
->
databaseName
.
'.system.indexes'
,
new
Query
(
$filter
,
$options
));
$cursor
=
$server
->
executeQuery
(
$this
->
databaseName
.
'.system.indexes'
,
new
Query
(
$filter
,
$options
));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
return
new
IndexInfoIteratorIterator
(
$cursor
);
return
new
IndexInfoIteratorIterator
(
$cursor
);
}
}
...
...
tests/Collection/CollectionFunctionalTest.php
View file @
81477df2
...
@@ -29,9 +29,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
...
@@ -29,9 +29,9 @@ class CollectionFunctionalTest extends FunctionalTestCase
'sort'
=>
array
(
'x'
=>
-
1
),
'sort'
=>
array
(
'x'
=>
-
1
),
);
);
$expected
=
array
(
'_id'
=>
3
,
'x'
=>
33
);
$expected
=
(
object
)
array
(
'_id'
=>
3
,
'x'
=>
33
);
$this
->
assert
Same
(
$expected
,
$this
->
collection
->
findOne
(
$filter
,
$options
));
$this
->
assert
Equals
(
$expected
,
$this
->
collection
->
findOne
(
$filter
,
$options
));
}
}
/**
/**
...
...
tests/FunctionalTestCase.php
View file @
81477df2
...
@@ -23,7 +23,7 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -23,7 +23,7 @@ abstract class FunctionalTestCase extends TestCase
list
(
$databaseName
,
$collectionName
)
=
explode
(
'.'
,
$namespace
,
2
);
list
(
$databaseName
,
$collectionName
)
=
explode
(
'.'
,
$namespace
,
2
);
$cursor
=
$this
->
manager
->
executeCommand
(
$databaseName
,
new
Command
(
array
(
'count'
=>
$collectionName
)));
$cursor
=
$this
->
manager
->
executeCommand
(
$databaseName
,
new
Command
(
array
(
'count'
=>
$collectionName
)));
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
$document
=
current
(
$cursor
->
toArray
());
$document
=
current
(
$cursor
->
toArray
());
$this
->
assertArrayHasKey
(
'n'
,
$document
);
$this
->
assertArrayHasKey
(
'n'
,
$document
);
...
@@ -76,7 +76,7 @@ abstract class FunctionalTestCase extends TestCase
...
@@ -76,7 +76,7 @@ abstract class FunctionalTestCase extends TestCase
$readPreference
?:
new
ReadPreference
(
ReadPreference
::
RP_PRIMARY
)
$readPreference
?:
new
ReadPreference
(
ReadPreference
::
RP_PRIMARY
)
);
);
$cursor
->
setTypeMap
(
array
(
'document'
=>
'array'
));
$cursor
->
setTypeMap
(
array
(
'
root'
=>
'array'
,
'
document'
=>
'array'
));
$document
=
current
(
$cursor
->
toArray
());
$document
=
current
(
$cursor
->
toArray
());
return
$document
[
'version'
];
return
$document
[
'version'
];
...
...
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