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
4b5a0a19
Unverified
Commit
4b5a0a19
authored
Feb 14, 2020
by
Andreas Braun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-530: Fix missing ns entry for idIndex in collection info
parent
a1af3588
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
CollectionInfoCommandIterator.php
src/Model/CollectionInfoCommandIterator.php
+21
-1
ListCollections.php
src/Operation/ListCollections.php
+1
-1
No files found.
src/Model/CollectionInfoCommandIterator.php
View file @
4b5a0a19
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
namespace
MongoDB\Model
;
namespace
MongoDB\Model
;
use
IteratorIterator
;
use
IteratorIterator
;
use
Traversable
;
/**
/**
* CollectionInfoIterator for listCollections command results.
* CollectionInfoIterator for listCollections command results.
...
@@ -32,6 +33,19 @@ use IteratorIterator;
...
@@ -32,6 +33,19 @@ use IteratorIterator;
*/
*/
class
CollectionInfoCommandIterator
extends
IteratorIterator
implements
CollectionInfoIterator
class
CollectionInfoCommandIterator
extends
IteratorIterator
implements
CollectionInfoIterator
{
{
/** @var string|null */
private
$databaseName
;
/**
* @param string|null $databaseName
*/
public
function
__construct
(
Traversable
$iterator
,
$databaseName
=
null
)
{
parent
::
__construct
(
$iterator
);
$this
->
databaseName
=
$databaseName
;
}
/**
/**
* Return the current element as a CollectionInfo instance.
* Return the current element as a CollectionInfo instance.
*
*
...
@@ -41,6 +55,12 @@ class CollectionInfoCommandIterator extends IteratorIterator implements Collecti
...
@@ -41,6 +55,12 @@ class CollectionInfoCommandIterator extends IteratorIterator implements Collecti
*/
*/
public
function
current
()
public
function
current
()
{
{
return
new
CollectionInfo
(
parent
::
current
());
$info
=
parent
::
current
();
if
(
$this
->
databaseName
!==
null
&&
isset
(
$info
[
'idIndex'
])
&&
!
isset
(
$info
[
'idIndex'
][
'ns'
]))
{
$info
[
'idIndex'
][
'ns'
]
=
$this
->
databaseName
.
'.'
.
$info
[
'name'
];
}
return
new
CollectionInfo
(
$info
);
}
}
}
}
src/Operation/ListCollections.php
View file @
4b5a0a19
...
@@ -136,6 +136,6 @@ class ListCollections implements Executable
...
@@ -136,6 +136,6 @@ class ListCollections implements Executable
$cursor
=
$server
->
executeReadCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
),
$this
->
createOptions
());
$cursor
=
$server
->
executeReadCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
),
$this
->
createOptions
());
$cursor
->
setTypeMap
([
'root'
=>
'array'
,
'document'
=>
'array'
]);
$cursor
->
setTypeMap
([
'root'
=>
'array'
,
'document'
=>
'array'
]);
return
new
CollectionInfoCommandIterator
(
new
CachingIterator
(
$cursor
));
return
new
CollectionInfoCommandIterator
(
new
CachingIterator
(
$cursor
)
,
$this
->
databaseName
);
}
}
}
}
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