Unverified Commit 8060d725 authored by Andreas Braun's avatar Andreas Braun

Merge pull request #721

parents 68d49083 8e9c0d5a
...@@ -22,7 +22,9 @@ cache: ...@@ -22,7 +22,9 @@ cache:
env: env:
global: global:
- DRIVER_VERSION=1.7.0 - DRIVER_VERSION=1.8.0
# Todo: Remove when v1.8 has been branched
- DRIVER_BRANCH="master"
- SERVER_DISTRO=enterprise-ubuntu1604 - SERVER_DISTRO=enterprise-ubuntu1604
- SERVER_VERSION=4.2.0 - SERVER_VERSION=4.2.0
- DEPLOYMENT=STANDALONE - DEPLOYMENT=STANDALONE
...@@ -125,16 +127,18 @@ jobs: ...@@ -125,16 +127,18 @@ jobs:
- DEPLOYMENT=SHARDED_CLUSTER_RS - DEPLOYMENT=SHARDED_CLUSTER_RS
# Test next patch release for driver # Test next patch release for driver
- stage: Test # Todo: enable when v1.8 has been branched
php: "7.3" # - stage: Test
env: # php: "7.3"
- DRIVER_BRANCH="v1.7" # env:
# - DRIVER_BRANCH="v1.8"
# Test next minor release for driver # Test next minor release for driver
- stage: Test # Todo: enable when v1.8 has been branched
php: "7.3" # - stage: Test
env: # php: "7.3"
- DRIVER_BRANCH="master" # env:
# - DRIVER_BRANCH="master"
before_install: before_install:
- pip install "mongo-orchestration>=0.6.7,<1.0" --user `whoami` - pip install "mongo-orchestration>=0.6.7,<1.0" --user `whoami`
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"php": "^7.0", "php": "^7.0",
"ext-hash": "*", "ext-hash": "*",
"ext-json": "*", "ext-json": "*",
"ext-mongodb": "^1.7" "ext-mongodb": "^1.8"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^6.4 || ^8.3", "phpunit/phpunit": "^6.4 || ^8.3",
......
...@@ -47,6 +47,17 @@ operation: ~ ...@@ -47,6 +47,17 @@ operation: ~
optional: true optional: true
--- ---
arg_name: option arg_name: option
name: allowDiskUse
type: boolean
description: |
Enables writing to temporary files. When set to ``true``, queries can write
data to the ``_tmp`` sub-directory in the ``dbPath`` directory. The default is
``false``.
interface: phpmethod
operation: ~
optional: true
---
arg_name: option
name: batchSize name: batchSize
type: integer type: integer
description: | description: |
......
...@@ -10,6 +10,10 @@ source: ...@@ -10,6 +10,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml file: apiargs-MongoDBCollection-method-find-option.yaml
ref: skip ref: skip
--- ---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source: source:
file: apiargs-MongoDBCollection-common-option.yaml file: apiargs-MongoDBCollection-common-option.yaml
ref: collation ref: collation
......
...@@ -14,6 +14,10 @@ source: ...@@ -14,6 +14,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml file: apiargs-MongoDBCollection-method-find-option.yaml
ref: limit ref: limit
--- ---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source: source:
file: apiargs-MongoDBCollection-method-find-option.yaml file: apiargs-MongoDBCollection-method-find-option.yaml
ref: batchSize ref: batchSize
......
...@@ -10,6 +10,10 @@ source: ...@@ -10,6 +10,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml file: apiargs-MongoDBCollection-method-find-option.yaml
ref: skip ref: skip
--- ---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source: source:
file: apiargs-MongoDBCollection-common-option.yaml file: apiargs-MongoDBCollection-common-option.yaml
ref: collation ref: collation
......
...@@ -72,6 +72,10 @@ class Find implements Executable, Explainable ...@@ -72,6 +72,10 @@ class Find implements Executable, Explainable
* *
* Supported options: * Supported options:
* *
* * allowDiskUse (boolean): Enables writing to temporary files. When set
* to true, queries can write data to the _tmp sub-directory in the
* dbPath directory. The default is false.
*
* * allowPartialResults (boolean): Get partial results from a mongos if * * allowPartialResults (boolean): Get partial results from a mongos if
* some shards are inaccessible (instead of throwing an error). * some shards are inaccessible (instead of throwing an error).
* *
...@@ -169,6 +173,10 @@ class Find implements Executable, Explainable ...@@ -169,6 +173,10 @@ class Find implements Executable, Explainable
throw InvalidArgumentException::invalidType('$filter', $filter, 'array or object'); throw InvalidArgumentException::invalidType('$filter', $filter, 'array or object');
} }
if (isset($options['allowDiskUse']) && ! is_bool($options['allowDiskUse'])) {
throw InvalidArgumentException::invalidType('"allowDiskUse" option', $options['allowDiskUse'], 'boolean');
}
if (isset($options['allowPartialResults']) && ! is_bool($options['allowPartialResults'])) { if (isset($options['allowPartialResults']) && ! is_bool($options['allowPartialResults'])) {
throw InvalidArgumentException::invalidType('"allowPartialResults" option', $options['allowPartialResults'], 'boolean'); throw InvalidArgumentException::invalidType('"allowPartialResults" option', $options['allowPartialResults'], 'boolean');
} }
...@@ -416,7 +424,7 @@ class Find implements Executable, Explainable ...@@ -416,7 +424,7 @@ class Find implements Executable, Explainable
} }
} }
foreach (['allowPartialResults', 'batchSize', 'comment', 'hint', 'limit', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'noCursorTimeout', 'oplogReplay', 'projection', 'readConcern', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'] as $option) { foreach (['allowDiskUse', 'allowPartialResults', 'batchSize', 'comment', 'hint', 'limit', 'maxAwaitTimeMS', 'maxScan', 'maxTimeMS', 'noCursorTimeout', 'oplogReplay', 'projection', 'readConcern', 'returnKey', 'showRecordId', 'skip', 'snapshot', 'sort'] as $option) {
if (isset($this->options[$option])) { if (isset($this->options[$option])) {
$options[$option] = $this->options[$option]; $options[$option] = $this->options[$option];
} }
......
...@@ -15,11 +15,7 @@ use function glob; ...@@ -15,11 +15,7 @@ use function glob;
class CrudSpecTest extends FunctionalTestCase class CrudSpecTest extends FunctionalTestCase
{ {
/** @var array */ /** @var array */
private static $incompleteTests = [ private static $incompleteTests = [];
'find-allowdiskuse: Find does not send allowDiskuse when value is not specified' => 'PHPLIB-500',
'find-allowdiskuse: Find sends allowDiskuse false when false is specified' => 'PHPLIB-500',
'find-allowdiskuse: Find sends allowDiskUse true when true is specified' => 'PHPLIB-500',
];
/** /**
* Assert that the expected and actual command documents match. * Assert that the expected and actual command documents match.
...@@ -29,6 +25,13 @@ class CrudSpecTest extends FunctionalTestCase ...@@ -29,6 +25,13 @@ class CrudSpecTest extends FunctionalTestCase
*/ */
public static function assertCommandMatches(stdClass $expected, stdClass $actual) public static function assertCommandMatches(stdClass $expected, stdClass $actual)
{ {
foreach ($expected as $key => $value) {
if ($value === null) {
static::assertObjectNotHasAttribute($key, $actual);
unset($expected->{$key});
}
}
static::assertDocumentsMatch($expected, $actual); static::assertDocumentsMatch($expected, $actual);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment