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

Merge pull request #721

parents 68d49083 8e9c0d5a
......@@ -22,7 +22,9 @@ cache:
env:
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_VERSION=4.2.0
- DEPLOYMENT=STANDALONE
......@@ -125,16 +127,18 @@ jobs:
- DEPLOYMENT=SHARDED_CLUSTER_RS
# Test next patch release for driver
- stage: Test
php: "7.3"
env:
- DRIVER_BRANCH="v1.7"
# Todo: enable when v1.8 has been branched
# - stage: Test
# php: "7.3"
# env:
# - DRIVER_BRANCH="v1.8"
# Test next minor release for driver
- stage: Test
php: "7.3"
env:
- DRIVER_BRANCH="master"
# Todo: enable when v1.8 has been branched
# - stage: Test
# php: "7.3"
# env:
# - DRIVER_BRANCH="master"
before_install:
- pip install "mongo-orchestration>=0.6.7,<1.0" --user `whoami`
......
......@@ -13,7 +13,7 @@
"php": "^7.0",
"ext-hash": "*",
"ext-json": "*",
"ext-mongodb": "^1.7"
"ext-mongodb": "^1.8"
},
"require-dev": {
"phpunit/phpunit": "^6.4 || ^8.3",
......
......@@ -47,6 +47,17 @@ operation: ~
optional: true
---
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
type: integer
description: |
......
......@@ -10,6 +10,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: skip
---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: collation
......
......@@ -14,6 +14,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: limit
---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: batchSize
......
......@@ -10,6 +10,10 @@ source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: skip
---
source:
file: apiargs-MongoDBCollection-method-find-option.yaml
ref: allowDiskUse
---
source:
file: apiargs-MongoDBCollection-common-option.yaml
ref: collation
......
......@@ -72,6 +72,10 @@ class Find implements Executable, Explainable
*
* 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
* some shards are inaccessible (instead of throwing an error).
*
......@@ -169,6 +173,10 @@ class Find implements Executable, Explainable
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'])) {
throw InvalidArgumentException::invalidType('"allowPartialResults" option', $options['allowPartialResults'], 'boolean');
}
......@@ -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])) {
$options[$option] = $this->options[$option];
}
......
......@@ -15,11 +15,7 @@ use function glob;
class CrudSpecTest extends FunctionalTestCase
{
/** @var array */
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',
];
private static $incompleteTests = [];
/**
* Assert that the expected and actual command documents match.
......@@ -29,6 +25,13 @@ class CrudSpecTest extends FunctionalTestCase
*/
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);
}
......
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