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
a0047660
Commit
a0047660
authored
Jan 30, 2016
by
Andreas Braun
Committed by
Jeremy Mikola
Feb 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-179: Don't apply typeMap if useCursor is false
parent
ad6c56db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
Collection.php
src/Collection.php
+1
-1
AggregateFunctionalTest.php
tests/Collection/CrudSpec/AggregateFunctionalTest.php
+21
-0
No files found.
src/Collection.php
View file @
a0047660
...
@@ -179,7 +179,7 @@ class Collection
...
@@ -179,7 +179,7 @@ class Collection
$options
[
'readPreference'
]
=
new
ReadPreference
(
ReadPreference
::
RP_PRIMARY
);
$options
[
'readPreference'
]
=
new
ReadPreference
(
ReadPreference
::
RP_PRIMARY
);
}
}
if
(
!
isset
(
$options
[
'typeMap'
]))
{
if
(
!
isset
(
$options
[
'typeMap'
])
&&
(
!
isset
(
$options
[
'useCursor'
])
||
$options
[
'useCursor'
])
)
{
$options
[
'typeMap'
]
=
$this
->
typeMap
;
$options
[
'typeMap'
]
=
$this
->
typeMap
;
}
}
...
...
tests/Collection/CrudSpec/AggregateFunctionalTest.php
View file @
a0047660
...
@@ -71,4 +71,25 @@ class AggregateFunctionalTest extends FunctionalTestCase
...
@@ -71,4 +71,25 @@ class AggregateFunctionalTest extends FunctionalTestCase
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$outputCollection
->
getCollectionName
());
$operation
=
new
DropCollection
(
$this
->
getDatabaseName
(),
$outputCollection
->
getCollectionName
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
$operation
->
execute
(
$this
->
getPrimaryServer
());
}
}
public
function
testAggregateWithoutCursorDoesNotApplyTypemap
()
{
$pipeline
=
[
[
'$group'
=>
[
'_id'
=>
null
,
'count'
=>
[
'$sum'
=>
1
]
]]
];
$options
=
[
'useCursor'
=>
false
];
$result
=
$this
->
collection
->
aggregate
(
$pipeline
,
$options
);
$expected
=
[
[
'_id'
=>
null
,
'count'
=>
3
,
],
];
$this
->
assertSameDocuments
(
$expected
,
$result
);
}
}
}
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