Commit 5ada2494 authored by Katherine Walker's avatar Katherine Walker

PHPLIB-340: Deprecate maxScan query option

parent bbfbbd65
......@@ -148,6 +148,7 @@ type: integer
description: |
Maximum number of documents or index keys to scan when executing the query.
.. deprecated:: 1.4
.. versionadded:: 1.2
interface: phpmethod
operation: ~
......
......@@ -85,6 +85,8 @@ class Find implements Executable, Explainable
* * maxScan (integer): Maximum number of documents or index keys to scan
* when executing the query.
*
* This option has been deprecated since version 1.4.
*
* * maxTimeMS (integer): The maximum amount of time to allow the query to
* run. If "$maxTimeMS" also exists in the modifiers document, this
* option will take precedence.
......@@ -265,6 +267,10 @@ class Find implements Executable, Explainable
trigger_error('The "snapshot" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
}
if (isset($options['maxScan'])) {
trigger_error('The "maxScan" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
}
$this->databaseName = (string) $databaseName;
$this->collectionName = (string) $collectionName;
$this->filter = $filter;
......
......@@ -56,6 +56,8 @@ class FindOne implements Executable, Explainable
* * maxScan (integer): Maximum number of documents or index keys to scan
* when executing the query.
*
* This option has been deprecated since version 1.4.
*
* * maxTimeMS (integer): The maximum amount of time to allow the query to
* run. If "$maxTimeMS" also exists in the modifiers document, this
* option will take precedence.
......
......@@ -139,6 +139,13 @@ class FindTest extends TestCase
});
}
public function testMaxScanOptionIsDeprecated()
{
$this->assertDeprecated(function() {
new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['maxScan' => 1]);
});
}
private function getInvalidHintValues()
{
return [123, 3.14, true];
......
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