-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPLIB-1143: Document Atlas Search index helpers and fix aggregate "c…
…ollation" docs (#1189) * PHPLIB-1143: Docs for Atlas Search index helpers * PHPLIB-1306: Add missing docs for aggregate "collation" option
- Loading branch information
Showing
20 changed files
with
525 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
docs/includes/apiargs-MongoDBCollection-method-createSearchIndex-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
arg_name: option | ||
name: name | ||
type: string | ||
description: | | ||
Name of the search index to create. | ||
You cannot create multiple indexes with the same name on a single collection. | ||
If you do not specify a name, the index is named "default". | ||
interface: phpmethod | ||
operation: ~ | ||
optional: true | ||
--- | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: comment | ||
... |
14 changes: 14 additions & 0 deletions
14
docs/includes/apiargs-MongoDBCollection-method-createSearchIndex-param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
arg_name: param | ||
name: $definition | ||
type: array|object | ||
description: | | ||
Document describing the index to create. For details on definition syntax, see | ||
:manual:`Search Index Definition Syntax </reference/command/createSearchIndexes/#search-index-definition-syntax>`. | ||
interface: phpmethod | ||
operation: ~ | ||
optional: false | ||
--- | ||
source: | ||
file: apiargs-common-param.yaml | ||
ref: $options | ||
... |
4 changes: 4 additions & 0 deletions
4
docs/includes/apiargs-MongoDBCollection-method-createSearchIndexes-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: comment | ||
... |
21 changes: 21 additions & 0 deletions
21
docs/includes/apiargs-MongoDBCollection-method-createSearchIndexes-param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
arg_name: param | ||
name: $indexes | ||
type: array | ||
description: | | ||
Array of documents describing the indexes to create. | ||
A required ``definition`` document field describes the index to create. For | ||
details on definition syntax, see | ||
:manual:`Search Index Definition Syntax </reference/command/createSearchIndexes/#search-index-definition-syntax>`. | ||
An optional ``name`` string field specifies the name of the search index to | ||
create. You cannot create multiple indexes with the same name on a single | ||
collection. If you do not specify a name, the index is named "default". | ||
interface: phpmethod | ||
operation: ~ | ||
optional: false | ||
--- | ||
source: | ||
file: apiargs-common-param.yaml | ||
ref: $options | ||
... |
4 changes: 4 additions & 0 deletions
4
docs/includes/apiargs-MongoDBCollection-method-dropSearchIndex-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: comment | ||
... |
13 changes: 13 additions & 0 deletions
13
docs/includes/apiargs-MongoDBCollection-method-dropSearchIndex-param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
arg_name: param | ||
name: $name | ||
type: string | ||
description: | | ||
Name of the index to drop. | ||
interface: phpmethod | ||
operation: ~ | ||
optional: false | ||
--- | ||
source: | ||
file: apiargs-common-param.yaml | ||
ref: $options | ||
... |
44 changes: 44 additions & 0 deletions
44
docs/includes/apiargs-MongoDBCollection-method-listSearchIndexes-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
source: | ||
file: apiargs-aggregate-option.yaml | ||
ref: batchSize | ||
--- | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: collation | ||
--- | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: comment | ||
--- | ||
arg_name: option | ||
name: name | ||
type: string | ||
description: | | ||
Name of the index to return information about. | ||
If name is not specified, information for all indexes on the collection will | ||
be returned. | ||
interface: phpmethod | ||
operation: ~ | ||
optional: true | ||
--- | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: maxTimeMS | ||
--- | ||
source: | ||
file: apiargs-MongoDBCollection-common-option.yaml | ||
ref: readConcern | ||
--- | ||
source: | ||
file: apiargs-MongoDBCollection-common-option.yaml | ||
ref: readPreference | ||
--- | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: session | ||
--- | ||
source: | ||
file: apiargs-MongoDBCollection-common-option.yaml | ||
ref: typeMap | ||
... |
4 changes: 4 additions & 0 deletions
4
docs/includes/apiargs-MongoDBCollection-method-listSearchIndexes-param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source: | ||
file: apiargs-common-param.yaml | ||
ref: $options | ||
... |
4 changes: 4 additions & 0 deletions
4
docs/includes/apiargs-MongoDBCollection-method-updateSearchIndex-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source: | ||
file: apiargs-common-option.yaml | ||
ref: comment | ||
... |
25 changes: 25 additions & 0 deletions
25
docs/includes/apiargs-MongoDBCollection-method-updateSearchIndex-param.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
arg_name: param | ||
name: $name | ||
type: string | ||
description: | | ||
Name of the index to update. | ||
interface: phpmethod | ||
operation: ~ | ||
optional: false | ||
--- | ||
arg_name: param | ||
name: $definition | ||
type: array|object | ||
description: | | ||
Document describing the updated search index definition. The specified | ||
definition replaces the prior definition in the search index. For details on | ||
definition syntax, see | ||
:manual:`Search Index Definition Syntax </reference/command/createSearchIndexes/#search-index-definition-syntax>`. | ||
interface: phpmethod | ||
operation: ~ | ||
optional: false | ||
--- | ||
source: | ||
file: apiargs-common-param.yaml | ||
ref: $options | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
docs/reference/method/MongoDBCollection-createSearchIndex.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
======================================== | ||
MongoDB\\Collection::createSearchIndex() | ||
======================================== | ||
|
||
.. versionadded:: 1.17 | ||
|
||
.. default-domain:: mongodb | ||
|
||
.. contents:: On this page | ||
:local: | ||
:backlinks: none | ||
:depth: 1 | ||
:class: singlecol | ||
|
||
Definition | ||
---------- | ||
|
||
.. phpmethod:: MongoDB\\Collection::createSearchIndex() | ||
|
||
Create an Atlas Search index for the collection. | ||
|
||
.. code-block:: php | ||
|
||
function createSearchIndex(array|object $definition, array $options = []): string | ||
|
||
This method has the following parameters: | ||
|
||
.. include:: /includes/apiargs/MongoDBCollection-method-createSearchIndex-param.rst | ||
|
||
The ``$options`` parameter supports the following options: | ||
|
||
.. include:: /includes/apiargs/MongoDBCollection-method-createSearchIndex-option.rst | ||
|
||
.. include:: /includes/extracts/note-atlas-search-requirement.rst | ||
.. include:: /includes/extracts/note-atlas-search-async.rst | ||
|
||
Return Values | ||
------------- | ||
|
||
The name of the created Atlas Search index as a string. | ||
|
||
Errors/Exceptions | ||
----------------- | ||
|
||
.. include:: /includes/extracts/error-unsupportedexception.rst | ||
.. include:: /includes/extracts/error-invalidargumentexception.rst | ||
.. include:: /includes/extracts/error-driver-runtimeexception.rst | ||
|
||
Examples | ||
-------- | ||
|
||
Create an Index with Dynamic Mappings | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
The following example creates an Atlas Search index using | ||
`dynamic mappings <https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#dynamic-mappings>`__ | ||
to index all document fields containing | ||
`supported data types <https://www.mongodb.com/docs/atlas/atlas-search/define-field-mappings/#std-label-bson-data-chart>`__. | ||
|
||
.. code-block:: php | ||
|
||
<?php | ||
|
||
$collection = (new MongoDB\Client)->selectCollection('test', 'articles'); | ||
|
||
$indexName = $collection->createSearchIndex( | ||
['mappings' => ['dynamic' => true]], | ||
['name' => 'test-search-index'] | ||
); | ||
|
||
var_dump($indexName); | ||
|
||
The output would then resemble: | ||
|
||
.. code-block:: none | ||
|
||
string(17) "test-search-index" | ||
|
||
See Also | ||
-------- | ||
|
||
- :phpmethod:`MongoDB\\Collection::createSearchIndexes()` | ||
- :phpmethod:`MongoDB\\Collection::dropSearchIndex()` | ||
- :phpmethod:`MongoDB\\Collection::listSearchIndexes()` | ||
- :phpmethod:`MongoDB\\Collection::updateSearchIndex()` | ||
- :manual:`createSearchIndexes </reference/command/createSearchIndexes>` command | ||
reference in the MongoDB manual | ||
- `Atlas Search <https://www.mongodb.com/docs/atlas/atlas-search/>`__ documentation in the MongoDB Manual |
Oops, something went wrong.