Skip to content

PHPLIB-596: Add tutorial for connecting to MongoDB #979

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 3 commits into from
Sep 28, 2022

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Sep 27, 2022

PHPLIB-596

This PR adds a small tutorial with information about connecting to MongoDB. The examples are taken from the documentation for MongoDB\Client::__construct, but provides them in a spot that should be easier to find.

Note: I haven't been able to build docs locally, and an attempt to build docs in a GitHub CI build also failed with the same error:

~/Code/mongodb/docs-php-library 
[master|✔] ❯❯❯ giza make html
Traceback (most recent call last):
  File "/opt/homebrew/bin/giza", line 5, in <module>
    from giza.cmdline import main
  File "/opt/homebrew/lib/python3.10/site-packages/giza/cmdline.py", line 19, in <module>
    from giza.config.runtime import RuntimeStateConfig
  File "/opt/homebrew/lib/python3.10/site-packages/giza/config/runtime.py", line 25, in <module>
    from giza.config.sphinx_config import available_sphinx_builders
  File "/opt/homebrew/lib/python3.10/site-packages/giza/config/sphinx_config.py", line 20, in <module>
    import sphinx.make_mode
ModuleNotFoundError: No module named 'sphinx.make_mode'

@alcaeus alcaeus requested a review from jmikola September 27, 2022 08:14
@alcaeus alcaeus self-assigned this Sep 27, 2022
Copy link
Member

@jmikola jmikola left a comment

Choose a reason for hiding this comment

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

Two small suggestions but I can confirm this builds locally (no new warnings):

$ ./rebuild.sh 
ERROR:giza.content.intersphinx:Error downloading https://docs.mongodb.com/manual/objects.inv: Got 308
/home/jmikola/.local/lib/python2.7/site-packages/giza/config/runtime.py:304: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  self._branch_conf = yaml.load(f)
source/reference/bson.txt:16: WARNING: term not in glossary: json
WARNING: logo file '.static/logo-mongodb.png' does not exist

And if you're curious what my rebuild.sh script does:

#!/bin/sh

rm -r build/master
rsync -a --delete ../phplib/docs/ source/
giza -l warning make publish

After that, I can view the output locally by pointing a web server to the build/master/html directory:

$ cat serve.sh 
#!/bin/sh
php -S localhost:8080 -t ./build/master/html/

@@ -27,6 +27,8 @@ following pages should help you get started:

- :doc:`/tutorial/install-php-library`

- :doc:`/tutorial/connecting`
Copy link
Member

Choose a reason for hiding this comment

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

Let's also add /tutorial/connecting to the toctree in tutorial.txt to ensure this page is surfaced there as well.

Tutorials
=========

.. default-domain:: mongodb

.. toctree::

+  /tutorial/connecting
   /tutorial/crud
   /tutorial/collation

@alcaeus alcaeus force-pushed the phplib-596-connection-tutorial branch from 69c273b to 470924c Compare September 28, 2022 06:07
@alcaeus alcaeus force-pushed the phplib-596-connection-tutorial branch from 470924c to 6650214 Compare September 28, 2022 06:10
@alcaeus alcaeus enabled auto-merge (squash) September 28, 2022 06:14
@alcaeus alcaeus merged commit 3a9c15e into mongodb:master Sep 28, 2022
@alcaeus alcaeus deleted the phplib-596-connection-tutorial branch October 7, 2022 06:43
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