diff --git a/generator/config/accumulator/accumulator.yaml b/generator/config/accumulator/accumulator.yaml index e90fbbf52..67505c7ea 100644 --- a/generator/config/accumulator/accumulator.yaml +++ b/generator/config/accumulator/accumulator.yaml @@ -73,7 +73,7 @@ tests: function(state, numCopies) { return { count: state.count + 1, sum: state.sum + numCopies } } - accumulateArgs: [ "$copies" ], + accumulateArgs: [ "$copies" ] merge: $code: |- function(state1, state2) { diff --git a/generator/config/stage/vectorSearch.yaml b/generator/config/stage/vectorSearch.yaml index ec4b4ff4b..bcd3c008a 100644 --- a/generator/config/stage/vectorSearch.yaml +++ b/generator/config/stage/vectorSearch.yaml @@ -22,7 +22,7 @@ arguments: - name: path type: - - searchPath + - string description: | Indexed vector type field to search. - diff --git a/src/Builder/Stage/FactoryTrait.php b/src/Builder/Stage/FactoryTrait.php index 7bbf3bc97..de5fc3977 100644 --- a/src/Builder/Stage/FactoryTrait.php +++ b/src/Builder/Stage/FactoryTrait.php @@ -716,7 +716,7 @@ public static function unwind( * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ * @param string $index Name of the Atlas Vector Search index to use. * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. - * @param array|string $path Indexed vector type field to search. + * @param string $path Indexed vector type field to search. * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. @@ -726,7 +726,7 @@ public static function unwind( public static function vectorSearch( string $index, int $limit, - array|string $path, + string $path, PackedArray|BSONArray|array $queryVector, Optional|bool $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, diff --git a/src/Builder/Stage/FluentFactoryTrait.php b/src/Builder/Stage/FluentFactoryTrait.php index 3cfd84cff..f8c15147c 100644 --- a/src/Builder/Stage/FluentFactoryTrait.php +++ b/src/Builder/Stage/FluentFactoryTrait.php @@ -805,7 +805,7 @@ public function unwind( * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ * @param string $index Name of the Atlas Vector Search index to use. * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. - * @param array|string $path Indexed vector type field to search. + * @param string $path Indexed vector type field to search. * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. @@ -815,7 +815,7 @@ public function unwind( public function vectorSearch( string $index, int $limit, - array|string $path, + string $path, PackedArray|BSONArray|array $queryVector, Optional|bool $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, diff --git a/src/Builder/Stage/VectorSearchStage.php b/src/Builder/Stage/VectorSearchStage.php index e8f7738cc..5a974c74e 100644 --- a/src/Builder/Stage/VectorSearchStage.php +++ b/src/Builder/Stage/VectorSearchStage.php @@ -48,8 +48,8 @@ final class VectorSearchStage implements StageInterface, OperatorInterface /** @var int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. */ public readonly int $limit; - /** @var array|string $path Indexed vector type field to search. */ - public readonly array|string $path; + /** @var string $path Indexed vector type field to search. */ + public readonly string $path; /** @var BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. */ public readonly PackedArray|BSONArray|array $queryVector; @@ -69,7 +69,7 @@ final class VectorSearchStage implements StageInterface, OperatorInterface /** * @param string $index Name of the Atlas Vector Search index to use. * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. - * @param array|string $path Indexed vector type field to search. + * @param string $path Indexed vector type field to search. * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. @@ -79,7 +79,7 @@ final class VectorSearchStage implements StageInterface, OperatorInterface public function __construct( string $index, int $limit, - array|string $path, + string $path, PackedArray|BSONArray|array $queryVector, Optional|bool $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, diff --git a/tests/FunctionalTestCase.php b/tests/FunctionalTestCase.php index 51c34cf3c..483823faa 100644 --- a/tests/FunctionalTestCase.php +++ b/tests/FunctionalTestCase.php @@ -334,7 +334,7 @@ protected function getFeatureCompatibilityVersion(?ReadPreference $readPreferenc $cursor = $this->manager->executeCommand( 'admin', new Command(['getParameter' => 1, 'featureCompatibilityVersion' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], ); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']); @@ -357,7 +357,7 @@ protected function getServerVersion(?ReadPreference $readPreference = null) $buildInfo = $this->manager->executeCommand( $this->getDatabaseName(), new Command(['buildInfo' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], )->toArray()[0]; if (isset($buildInfo->version) && is_string($buildInfo->version)) { @@ -372,7 +372,7 @@ protected function getServerStorageEngine(?ReadPreference $readPreference = null $cursor = $this->manager->executeCommand( $this->getDatabaseName(), new Command(['serverStatus' => 1]), - $readPreference ?: new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => $readPreference ?: new ReadPreference(ReadPreference::PRIMARY)], ); $result = current($cursor->toArray()); diff --git a/tests/SpecTests/PrimaryStepDownSpecTest.php b/tests/SpecTests/PrimaryStepDownSpecTest.php index 2de6d4c44..bc060c061 100644 --- a/tests/SpecTests/PrimaryStepDownSpecTest.php +++ b/tests/SpecTests/PrimaryStepDownSpecTest.php @@ -270,7 +270,7 @@ private function getTotalConnectionsCreated(?Server $server = null) $cursor = $server->executeCommand( $this->getDatabaseName(), new Command(['serverStatus' => 1]), - new ReadPreference(ReadPreference::PRIMARY), + ['readPreference' => new ReadPreference(ReadPreference::PRIMARY)], ); $cursor->setTypeMap(['root' => 'array', 'document' => 'array']);