PHPLIB-480: Deprecate MapReduce options

parent 25c7b857
...@@ -266,6 +266,8 @@ class MapReduce implements Executable ...@@ -266,6 +266,8 @@ class MapReduce implements Executable
@trigger_error('Use of Javascript with scope in "finalize" option for MapReduce is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.', E_USER_DEPRECATED); @trigger_error('Use of Javascript with scope in "finalize" option for MapReduce is deprecated. Put all scope variables in the "scope" option of the MapReduce operation.', E_USER_DEPRECATED);
} }
$this->checkOutDeprecations($out);
$this->databaseName = (string) $databaseName; $this->databaseName = (string) $databaseName;
$this->collectionName = (string) $collectionName; $this->collectionName = (string) $collectionName;
$this->map = $map; $this->map = $map;
...@@ -334,6 +336,27 @@ class MapReduce implements Executable ...@@ -334,6 +336,27 @@ class MapReduce implements Executable
return new MapReduceResult($getIterator, $result); return new MapReduceResult($getIterator, $result);
} }
/**
* @param string|array|object $out
* @return void
*/
private function checkOutDeprecations($out)
{
if (is_string($out)) {
return;
}
$out = (array) $out;
if (isset($out['nonAtomic']) && ! $out['nonAtomic']) {
@trigger_error('Specifying false for "out.nonAtomic" is deprecated.', E_USER_DEPRECATED);
}
if (isset($out['sharded']) && ! $out['sharded']) {
@trigger_error('Specifying false for "out.sharded" is deprecated.', E_USER_DEPRECATED);
}
}
/** /**
* Create the mapReduce command. * Create the mapReduce command.
* *
......
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