Skip to content

Commit dbd7926

Browse files
committed
PHPLIB-1513: Remove the mapReduce helper
1 parent 8694edf commit dbd7926

File tree

6 files changed

+0
-870
lines changed

6 files changed

+0
-870
lines changed

src/Collection.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use Countable;
2121
use Iterator;
2222
use MongoDB\BSON\Document;
23-
use MongoDB\BSON\JavascriptInterface;
2423
use MongoDB\BSON\PackedArray;
2524
use MongoDB\Builder\BuilderEncoder;
2625
use MongoDB\Builder\Pipeline;
@@ -63,7 +62,6 @@
6362
use MongoDB\Operation\InsertOne;
6463
use MongoDB\Operation\ListIndexes;
6564
use MongoDB\Operation\ListSearchIndexes;
66-
use MongoDB\Operation\MapReduce;
6765
use MongoDB\Operation\RenameCollection;
6866
use MongoDB\Operation\ReplaceOne;
6967
use MongoDB\Operation\UpdateMany;
@@ -904,46 +902,6 @@ public function listSearchIndexes(array $options = []): Iterator
904902
return $operation->execute($server);
905903
}
906904

907-
/**
908-
* Executes a map-reduce aggregation on the collection.
909-
*
910-
* @see MapReduce::__construct() for supported options
911-
* @see https://mongodb.com/docs/manual/reference/command/mapReduce/
912-
* @param JavascriptInterface $map Map function
913-
* @param JavascriptInterface $reduce Reduce function
914-
* @param string|array|object $out Output specification
915-
* @param array $options Command options
916-
* @throws UnsupportedException if options are not supported by the selected server
917-
* @throws InvalidArgumentException for parameter/option parsing errors
918-
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
919-
* @throws UnexpectedValueException if the command response was malformed
920-
*/
921-
public function mapReduce(JavascriptInterface $map, JavascriptInterface $reduce, string|array|object $out, array $options = []): MapReduceResult
922-
{
923-
$hasOutputCollection = ! is_mapreduce_output_inline($out);
924-
925-
// Check if the out option is inline because we will want to coerce a primary read preference if not
926-
if ($hasOutputCollection) {
927-
$options['readPreference'] = new ReadPreference(ReadPreference::PRIMARY);
928-
} else {
929-
$options = $this->inheritReadPreference($options);
930-
}
931-
932-
/* A "majority" read concern is not compatible with inline output, so
933-
* avoid providing the Collection's read concern if it would conflict.
934-
*/
935-
if (! $hasOutputCollection || $this->readConcern->getLevel() !== ReadConcern::MAJORITY) {
936-
$options = $this->inheritReadConcern($options);
937-
}
938-
939-
$options = $this->inheritWriteOptions($options);
940-
$options = $this->inheritTypeMap($options);
941-
942-
$operation = new MapReduce($this->databaseName, $this->collectionName, $map, $reduce, $out, $options);
943-
944-
return $operation->execute(select_server_for_write($this->manager, $options));
945-
}
946-
947905
/**
948906
* Renames the collection.
949907
*

0 commit comments

Comments
 (0)