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

Update documentation for 1.1.0 #276

merged 15 commits into from
Nov 1, 2016

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Oct 28, 2016

@jmikola jmikola force-pushed the 1.1-docs branch 3 times, most recently from 652635a to 5275b6c Compare October 31, 2016 20:48
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.

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.

interface: phpmethod
operation: MongoDB\\Client::__construct
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).

operation: MongoDB\\Collection::aggregate
position: 5
post: |
This only applies when using the :pipeline:`$out` stage.
Copy link
Member Author

Choose a reason for hiding this comment

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

For my local builds, :pipline: was not resolved as a link and merely applied fixed-width formatting to "$out". Is that intentional?

Copy link
Contributor

Choose a reason for hiding this comment

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

That happens if a link is not resolved. This is bad enough, but Sphinx won't resolve links to a pipeline/method/whatever defined on the same page.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this just a byproduct of me rendering the PHPLIB docs separately from the main manual (on my local machine), or do you expect this would persist even in the final builds. I might as well just use $out if this will have no effect in the deployed version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, just use double-ticks.

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 is creating a ref link in the MongoDB manual for this: agg-out.

You can specify any index options that your MongoDB version
supports. MongoDB 3.2 includes the following options:

.. include:: /includes/apiargs/MongoDBCollection-method-createIndex-option.rst
Copy link
Member Author

Choose a reason for hiding this comment

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

After adding the actual parameter and options includes for this method, which differ from createIndex(), I tried moving the general index options into a section below entitled "$indexes parameter". I found that the table didn't render the same as this "Definition" section (with leading indentation). The second paragraph of each option description would increase in font size, which is likely a CSS issue.

Ultimately, I decided not to repeat the index options and instead link to createIndex() and the MongoDB manual. I feel this also works better because writeConcern is one of the createIndex() method options despite the fact that it's not an index option. Maintaining a separate include of just index options and writeConcern seemed like a fair bit of overhead. As-is, explaining how $indexes works in its own section below makes createIndexes() method docs easier to digest, since we only discuss the actual params/options in the "Definition" section.


.. include:: /includes/apiargs/MongoDBClient-method-dropDatabase-option.rst

Output
------
:returns:
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 spoke to @kay-kim about "Output" vs. :returns: and she said the manual tends to use :returns: for one-liners and "Output" for larger descriptions. I may want to switch this back to its own heading, since the :returns: output does look a bit crowded for multiple lines of text.

The PHP.net documentation has actual headings for "Errors" and "Return Values", so I will probably mimic that. "Output" doesn't quite make as much sense for PHPLIB as it does for the MongoDB shell, since our return values are not implicitly printed to a console.

Currently, I'm using :returns: everywhere so we can probably leave it as-is in this PR and I'll revise this later when also documenting our exceptions.


.. code-block:: php

function listDatabases(array $options = []): MongoDB\Model\DatabaseInfoIterator

:phpmethod:`MongoDB\\Client::listDatabases` has the following parameters:
:phpmethod:`MongoDB\\Client::listDatabases()` has the following parameters:
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there value in using a :phpmethod: reference here instead of saying "This method"? I noticed that it only renders as fixed-width text instead of a link to the current page. Considering that we already repeat the method name twice immediately before this, I'm dubious that this is any better than common text like I'm using below for $options.

Copy link
Contributor

Choose a reason for hiding this comment

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

I generally suggest not using role-links to things defined on the current page, since they don't render the way humans would expect.


.. include:: /includes/apiargs/MongoDBGridFSBucket-method-downloadToStreamByName-option.rst

.. todo: add examples
Copy link
Member Author

Choose a reason for hiding this comment

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

Does .. todo actually render any output or is there merely an internal comment that the docs team can use to find areas needing improvement down the line?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's just a comment.

RestructuredText is weird: anything starting with two periods .. is a comment, UNLESS the first word ends with a double-colon ::, in which case it's a directive.

file: apiargs-MongoDBCollection-method-find-option.yaml
ref: typeMap
replacement:
parent: "bucket"
Copy link
Member Author

Choose a reason for hiding this comment

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

This will depend on PHPLIB-232.

@jmikola jmikola merged commit c63ca8d into mongodb:master Nov 1, 2016
jmikola added a commit that referenced this pull request Nov 1, 2016
@jmikola jmikola changed the title [WIP] Update documentation for 1.1.0 Update documentation for 1.1.0 Nov 1, 2016
@jmikola jmikola deleted the 1.1-docs branch November 1, 2016 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants