Skip to content

Update documentation for 1.1.0 #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Nov 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
arg_name: option
name: typeMap
type: array
description: |
Default :php:`type map
<manual/en/mongodb.persistence.deserialization.php#mongodb.persistence.typemaps>`
to apply to cursors, which determines how BSON documents are converted to PHP
values. The |php-library| uses the following type map by default:

.. code-block:: php
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAML uses a 2-space indent, so I'm using that for the description indent level; however, the contents uses a 3-space indent to be consistent with RST sources.

I also stuck with an 80-char wrap for consistency with PHPLIB, which admittedly differs from the manual's 72-char wrap.


[
'array' => 'MongoDB\Model\BSONArray',
'document' => 'MongoDB\Model\BSONDocument',
'root' => 'MongoDB\Model\BSONDocument',
]
interface: phpmethod
operation: ~
optional: true
...
47 changes: 21 additions & 26 deletions docs/includes/apiargs-MongoDBClient-method-construct-param.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,41 @@ arg_name: param
name: $uri
type: string
description: |
The URI of the standalone, replica set, or sharded cluster to which to connect. Refer
to the :manual:`MongoDB connection string reference </reference/connection-string>`
for formatting.
Defaults to ``mongodb://localhost:27017`` if unspecified.
The URI of the standalone, replica set, or sharded cluster to which to
connect. Refer to the :manual:`MongoDB connection string reference
</reference/connection-string>` for formatting.

Defaults to ``"mongodb://127.0.0.1:27017"`` if unspecified.
interface: phpmethod
operation: MongoDB\\Client::__construct
operation: ~
optional: true
position: 1
---
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that position was not required by the model. By default, the order is derived from the YAML file's own ordering (starting with 1 and incrementing with each new definition).

arg_name: param
name: $uriOptions
type: array
description: |
Specifies additional URI options, such as authentication credentials
or query string parameters. The options specified in ``$uriOptions``
take precedence over any analogous options present in the
``$uri`` string.
post: |
Specifies additional URI options, such as authentication credentials or query
string parameters. The options specified in ``$uriOptions`` take precedence
over any analogous options present in the ``$uri`` string.

Refer to the :php:`MongoDB\\Driver\\Manager::__construct()
<mongodb-driver-manager.construct>` extension reference and
:manual:`MongoDB connection string </reference/connection-string>`
documentation for valid options.
<mongodb-driver-manager.construct>` extension reference and :manual:`MongoDB
connection string </reference/connection-string>` documentation for accepted
options.
interface: phpmethod
operation: MongoDB\\Client::__construct
operation: ~
optional: true
position: 2
---
arg_name: param
name: $driverOptions
type: array
description: |
Specify driver-specific options. In addition to any
options supported by the :php:`extension <mongodb-driver-manager>`,
the |php-library| allows you to specify a default ``typeMap`` to
apply to the cursors it creates. Refer to the driver's
:php:`Persistence documentation <mongodb-persistence>` for more
about type maps.
Specify driver-specific options, such as SSL options. In addition to any
options supported by the :php:`extension <mongodb-driver-manager>`, the
|php-library| allows you to specify a default :php:`type map
<manual/en/mongodb.persistence.deserialization.php#mongodb.persistence.typemaps>`
to apply to the cursors it creates.
interface: phpmethod
operation: MongoDB\\Client::__construct
operation: ~
optional: true
position: 3
...
...
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
arg_name: option
interface: phpmethod
operation: MongoDB\\Client::dropDatabase
source:
file: apiargs-common-option.yaml
ref: typeMap
position: 1
post: |
This will be used for the returned command result document.
---
arg_name: option
name: writeConcern
type: :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
description: |
:manual:`Write concern </reference/write-concern>` to use for the operation.
Defaults to the client's write concern.

This is not supported for server versions prior to 3.4 and will result in an
exception at execution time if used.
interface: phpmethod
operation: ~
optional: true
...
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
source:
ref: $databaseName
file: apiargs-common-param.yaml
arg_name: param
interface: phpmethod
operation: MongoDB\\Client::dropDatabase
ref: $databaseName
replacement:
action: " to drop"
---
source:
ref: $options
file: apiargs-common-param.yaml
arg_name: param
interface: phpmethod
operation: MongoDB\\Client::dropDatabase
position: 2
ref: $options
...
7 changes: 3 additions & 4 deletions docs/includes/apiargs-MongoDBClient-method-get-param.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source:
ref: $databaseName
file: apiargs-common-param.yaml
arg_name: param
interface: phpmethod
operation: MongoDB\\Client::__get
ref: $databaseName
replacement:
action: " to select"
...
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
source:
file: apiargs-common-option.yaml
ref: maxTimeMS
position: 1
...
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
source:
ref: $options
file: apiargs-common-param.yaml
arg_name: param
interface: phpmethod
operation: MongoDB\\Client::listDatabases
position: 1
ref: $options
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
source:
file: apiargs-common-option.yaml
ref: readConcern
replacement:
resource: "collection"
parent: "client"
---
source:
file: apiargs-common-option.yaml
ref: readPreference
replacement:
resource: "collection"
parent: "client"
---
source:
file: apiargs-common-option.yaml
ref: typeMap
replacement:
parent: "client"
---
source:
file: apiargs-common-option.yaml
ref: writeConcern
replacement:
resource: "collection"
parent: "client"
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
source:
file: apiargs-common-param.yaml
ref: $databaseName
replacement:
action: " containing the collection to select"
---
source:
file: apiargs-common-param.yaml
ref: $collectionName
replacement:
action: " to select"
---
source:
file: apiargs-common-param.yaml
ref: $options
...
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
source:
ref: readConcern
file: apiargs-common-option.yaml
operation: MongoDB\\Client::selectDatabase
ref: readConcern
replacement:
resource: "database"
parent: "client"
---
source:
ref: readPreference
file: apiargs-common-option.yaml
operation: MongoDB\\Client::selectDatabase
ref: readPreference
replacement:
resource: "database"
parent: "client"
---
source:
ref: typeMap
file: apiargs-common-option.yaml
operation: MongoDB\\Client::selectDatabase
ref: typeMap
replacement:
parent: "client"
---
source:
ref: writeConcern
file: apiargs-common-option.yaml
operation: MongoDB\\Client::selectDatabase
ref: writeConcern
replacement:
resource: "database"
...
parent: "client"
...
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
source:
ref: $databaseName
file: apiargs-common-param.yaml
operation: MongoDB\\Client::selectDatabase
position: 1
ref: $databaseName
replacement:
action: " to select"
---
source:
ref: $options
file: apiargs-common-param.yaml
operation: MongoDB\\Client::selectDatabase
position: 2
ref: $options
...
79 changes: 79 additions & 0 deletions docs/includes/apiargs-MongoDBCollection-common-option.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
arg_name: option
name: bypassDocumentValidation
type: boolean
description: |
If ``true``, allows the write operation to circumvent document level
validation. Defaults to ``false``.
interface: phpmethod
operation: ~
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@schmalliso noted that operation, while a required key in the Python model, is only used for replacing {{role}} in content. I decided to use operation: ~ (i.e. null) for common option/param definitions and will probably do so for all definitions.

optional: true
---
arg_name: option
name: collation
type: array|object
description: |
:manual:`Collation </reference/collation>` allows users to specify
language-specific rules for string comparison, such as rules for lettercase
and accent marks. When specifying collation, the ``locale`` field is
mandatory; all other collation fields are optional. For descriptions of the
fields, see :manual:`Collation Document
<reference/collation/#collation-document>`.

If the collation is unspecified but the collection has a default collation,
the operation uses the collation specified for the collection. If no
collation is specified for the collection or for the operation, MongoDB uses
the simple binary comparison used in prior versions for string comparisons.

This option is available in MongoDB 3.4+ and will result in an exception at
execution time if specified for an older server version.
interface: phpmethod
operation: ~
optional: true
---
arg_name: option
name: readConcern
type: :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>`
description: |
:manual:`Read concern </reference/read-concern>` to use for the operation.
Defaults to the collection's read concern.
interface: phpmethod
operation: ~
optional: true
---
arg_name: option
name: readPreference
type: :php:`MongoDB\\Driver\\ReadPreference <class.mongodb-driver-readpreference>`
description: |
:manual:`Read preference </reference/read-preference>` to use for the
operation. Defaults to the collection's read preference.
interface: phpmethod
operation: ~
optional: true
---
source:
file: apiargs-common-option.yaml
ref: typeMap
replacement:
parent: "collection"
---
arg_name: option
name: writeConcern
type: :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
description: |
:manual:`Write concern </reference/write-concern>` to use for the operation.
Defaults to the collection's write concern.
interface: phpmethod
operation: ~
optional: true
---
arg_name: option
name: upsert
type: boolean
description: |
If set to ``true``, creates a new document when no document matches the query
criteria. The default value is ``false``, which does not insert a new
document when no match is found.
interface: phpmethod
operation: ~
optional: true
...
31 changes: 31 additions & 0 deletions docs/includes/apiargs-MongoDBCollection-common-param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
arg_name: param
name: $filter
type: array|object
description: |
The filter criteria that specifies the documents{{action}}.
interface: phpmethod
operation: ~
optional: false
replacement:
action: ""
---
arg_name: param
name: $replacement
type: array|object
description: |
The replacement document.
interface: phpmethod
operation: ~
optional: false
---
arg_name: param
name: $update
type: array|object
description: |
Specifies the field and value combinations to update and any relevant update
operators. ``$update`` uses MongoDB's :method:`update operators
</reference/operator/update>`.
interface: phpmethod
operation: ~
optional: false
...
Loading