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
3028dfde
Commit
3028dfde
authored
Jun 15, 2015
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return documents as objects from Collection findAndModify methods
parent
02e651cb
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
20 deletions
+20
-20
Collection.php
src/Collection.php
+3
-3
FindAndModify.php
src/Operation/FindAndModify.php
+2
-2
FindOneAndDelete.php
src/Operation/FindOneAndDelete.php
+1
-1
FindOneAndReplace.php
src/Operation/FindOneAndReplace.php
+1
-1
FindOneAndUpdate.php
src/Operation/FindOneAndUpdate.php
+1
-1
FindOneAndDeleteFunctionalTest.php
tests/Collection/CrudSpec/FindOneAndDeleteFunctionalTest.php
+2
-2
FindOneAndReplaceFunctionalTest.php
...s/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
+5
-5
FindOneAndUpdateFunctionalTest.php
tests/Collection/CrudSpec/FindOneAndUpdateFunctionalTest.php
+5
-5
No files found.
src/Collection.php
View file @
3028dfde
...
...
@@ -460,7 +460,7 @@ class Collection
* @see FindOneAndDelete::__construct() for supported options
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @return
array
|null
* @return
object
|null
*/
public
function
findOneAndDelete
(
$filter
,
array
$options
=
array
())
{
...
...
@@ -482,7 +482,7 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $replacement Replacement document
* @param array $options Command options
* @return
array
|null
* @return
object
|null
*/
public
function
findOneAndReplace
(
$filter
,
$replacement
,
array
$options
=
array
())
{
...
...
@@ -504,7 +504,7 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @return
array
|null
* @return
object
|null
*/
public
function
findOneAndUpdate
(
$filter
,
$update
,
array
$options
=
array
())
{
...
...
src/Operation/FindAndModify.php
View file @
3028dfde
...
...
@@ -113,7 +113,7 @@ class FindAndModify implements Executable
*
* @see Executable::execute()
* @param Server $server
* @return
array
|null
* @return
object
|null
*/
public
function
execute
(
Server
$server
)
{
...
...
@@ -143,7 +143,7 @@ class FindAndModify implements Executable
throw
new
UnexpectedValueException
(
'findAndModify command did not return a "value" document'
);
}
return
(
array
)
$result
[
'value'
];
return
$result
[
'value'
];
}
/**
...
...
src/Operation/FindOneAndDelete.php
View file @
3028dfde
...
...
@@ -74,7 +74,7 @@ class FindOneAndDelete implements Executable
*
* @see Executable::execute()
* @param Server $server
* @return
array
|null
* @return
object
|null
*/
public
function
execute
(
Server
$server
)
{
...
...
src/Operation/FindOneAndReplace.php
View file @
3028dfde
...
...
@@ -113,7 +113,7 @@ class FindOneAndReplace implements Executable
*
* @see Executable::execute()
* @param Server $server
* @return
array
|null
* @return
object
|null
*/
public
function
execute
(
Server
$server
)
{
...
...
src/Operation/FindOneAndUpdate.php
View file @
3028dfde
...
...
@@ -113,7 +113,7 @@ class FindOneAndUpdate implements Executable
*
* @see Executable::execute()
* @param Server $server
* @return
array
|null
* @return
object
|null
*/
public
function
execute
(
Server
$server
)
{
...
...
tests/Collection/CrudSpec/FindOneAndDeleteFunctionalTest.php
View file @
3028dfde
...
...
@@ -25,7 +25,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndDelete
(
$filter
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -44,7 +44,7 @@ class FindOneAndDeleteFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndDelete
(
$filter
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
tests/Collection/CrudSpec/FindOneAndReplaceFunctionalTest.php
View file @
3028dfde
...
...
@@ -29,7 +29,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndReplace
(
$filter
,
$replacement
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -51,7 +51,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndReplace
(
$filter
,
$replacement
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
32
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
32
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -72,7 +72,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndReplace
(
$filter
,
$replacement
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -94,7 +94,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndReplace
(
$filter
,
$replacement
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
32
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
32
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -185,7 +185,7 @@ class FindOneAndReplaceFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndReplace
(
$filter
,
$replacement
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
44
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
44
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
tests/Collection/CrudSpec/FindOneAndUpdateFunctionalTest.php
View file @
3028dfde
...
...
@@ -29,7 +29,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndUpdate
(
$filter
,
$update
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -51,7 +51,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndUpdate
(
$filter
,
$update
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
23
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
23
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -72,7 +72,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndUpdate
(
$filter
,
$update
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
22
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
22
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -94,7 +94,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndUpdate
(
$filter
,
$update
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
23
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
23
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
@@ -183,7 +183,7 @@ class FindOneAndUpdateFunctionalTest extends FunctionalTestCase
);
$document
=
$this
->
collection
->
findOneAndUpdate
(
$filter
,
$update
,
$options
);
$this
->
assert
Same
(
array
(
'x'
=>
1
),
$document
);
$this
->
assert
Equals
((
object
)
array
(
'x'
=>
1
),
$document
);
$expected
=
array
(
array
(
'_id'
=>
1
,
'x'
=>
11
),
...
...
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