Skip to content

Commit 9482693

Browse files
committed
Add version to docs and object casting to command prep
1 parent cfeaec2 commit 9482693

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

docs/includes/apiargs-MongoDBCollection-method-aggregate-option.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,18 @@ post: |
3434
Document validation requires MongoDB 3.2 or later: if you are using an earlier
3535
version of MongoDB, this option will be ignored.
3636
---
37-
source:
38-
file: apiargs-MongoDBCollection-method-find-option.yaml
39-
ref: hint
37+
arg_name: option
38+
name: hint
39+
type: string|array|object
40+
description: |
41+
The index to use. Specify either the index name as a string or the index key
42+
pattern as a document. If specified, then the query system will only consider
43+
plans using the hinted index.
44+
45+
.. versionadded:: 1.3
46+
interface: phpmethod
47+
operation: ~
48+
optional: true
4049
---
4150
source:
4251
file: apiargs-common-option.yaml

src/Operation/Aggregate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private function createCommand(Server $server, $isCursorSupported)
281281
}
282282

283283
if (isset($this->options['hint'])) {
284-
$cmd['hint'] = $this->options['hint'];
284+
$cmd['hint'] = is_array($this->options['hint']) ? (object) $this->options['hint'] : $this->options['hint'];
285285
}
286286

287287
if (isset($this->options['maxTimeMS'])) {

0 commit comments

Comments
 (0)