Skip to content

Commit 0f3d840

Browse files
author
Chris Cho
committed
DOCSP-35892: quick start docs
1 parent 78fe1fb commit 0f3d840

File tree

10 files changed

+261
-83
lines changed

10 files changed

+261
-83
lines changed
34.6 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.. note::
2+
3+
If you run into issues on this step, ask for help in the
4+
:community-forum:`MongoDB Community Forums <>` or submit feedback by using
5+
the :guilabel:`Share Feedback` tab on the right or bottom right side of the
6+
page.
7+

docs/index.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Laravel MongoDB
1313
:titlesonly:
1414
:maxdepth: 1
1515

16+
/quick-start
1617
/install
1718
/eloquent-models
1819
/query-builder
@@ -40,6 +41,13 @@ Laravel Eloquent and Query Builder syntax to work with your MongoDB data.
4041
see `Laravel Version Compatibility <https://github.com/mongodb/laravel-mongodb/blob/3.9/README.md#installation>`__
4142
on GitHub.
4243

44+
Quick Start
45+
-----------
46+
47+
Learn how to create and configure a Laravel web application to connect to
48+
MongoDB hosted on MongoDB Atlas by using {+odm-short+} and begin working
49+
with data in the :ref:`laravel-quck-start` section.
50+
4351
Getting Started
4452
---------------
4553

@@ -70,7 +78,7 @@ Reporting Issues
7078
We are lucky to have a vibrant PHP community that includes users of varying
7179
experience with MongoDB PHP Library and {+odm-short+}. To get support for
7280
general questions, search or post in the
73-
`MongoDB Community Forums <https://www.mongodb.com/community/forums/>`__.
81+
:community-forum:`MongoDB Community Forums <>`__.
7482

7583
To learn more about MongoDB support options, see the
7684
`Technical Support <https://www.mongodb.org/about/support>`__ page.

docs/install.txt

Lines changed: 0 additions & 82 deletions
This file was deleted.

docs/quick-start.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
.. _laravel-quickstart:
2+
3+
===========
4+
Quick Start
5+
===========
6+
7+
.. facet::
8+
:name: genre
9+
:values: tutorial
10+
11+
.. meta::
12+
:keywords: php framework, odm
13+
14+
.. contents:: On this page
15+
:local:
16+
:backlinks: none
17+
:depth: 1
18+
:class: singlecol
19+
20+
Overview
21+
--------
22+
23+
This guide shows you how to create and configure Laravel web application
24+
and the {+odm-long+} to use a MongoDB cluster hosted on MongoDB Atlas as the
25+
database.
26+
27+
If you prefer to connect to MongoDB by using the PHP Library, see
28+
`Connecting to MongoDB <https://www.mongodb.com/docs/php-library/current/tutorial/connecting/>`__
29+
in the PHP Library documentation.
30+
31+
{+odm-short+} extends the Laravel Eloquent and Query Builder syntax to
32+
store and retrieve data from MongoDB.
33+
34+
MongoDB Atlas is a fully managed cloud database service that hosts your
35+
MongoDB deployments. You can create your own free (no credit card
36+
required) MongoDB Atlas deployment by following the steps in this guide.
37+
38+
Follow the steps in this guide to create a sample Laravel web application
39+
that connects to a MongoDB deployment.
40+
41+
.. button:: Next: Download and Install
42+
:uri: /quick-start/download-and-install/
43+
44+
.. toctree::
45+
46+
/quick-start/download-and-install/
47+
/quick-start/create-a-deployment/
48+
/quick-start/create-a-connection-string/
49+
/quick-start/connect-to-mongodb/
50+
/quick-start/next-steps/
51+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.. _laravelt-quick-start-connect-to-mongodb:
2+
3+
==================
4+
Connect to MongoDB
5+
==================
6+
7+
.. facet::
8+
:name: genre
9+
:values: tutorial
10+
11+
.. meta::
12+
:keywords: test connection, runnable, code example
13+
14+
.. procedure::
15+
:style: connected
16+
17+
.. step:: Create your Laravel Application
18+
19+
.. step:: Assign the Connection String
20+
21+
Replace the ``<connection string>`` placeholder with the connection
22+
string that you copied from the :ref:`laravel-quick-start-connection-string`
23+
step of this guide.
24+
25+
.. step:: Run your Laravel Application
26+
27+
TODO
28+
29+
After you complete these steps, you have a Laravel web application that
30+
uses the {+odm-long+} to connect to your MongoDB deployment, run a query on
31+
the sample data, and render a retrieved result.
32+
33+
.. include:: /includes/quick-start/troubleshoot.rst
34+
35+
.. button:: Next Steps
36+
:uri: /quick-start/next-steps/
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.. _laravel-quick-start-connection-string:
2+
3+
==========================
4+
Create a Connection String
5+
==========================
6+
7+
You can connect to your MongoDB deployment by providing a
8+
**connection URI**, also called a *connection string*, which
9+
instructs the driver on how to connect to a MongoDB deployment
10+
and how to behave while connected.
11+
12+
The connection string includes the hostname or IP address and
13+
port of your deployment, the authentication mechanism, user credentials
14+
when applicable, and connection options.
15+
16+
To connect to an instance or deployment not hosted on Atlas, see TODO
17+
18+
.. procedure::
19+
:style: connected
20+
21+
.. step:: Find your MongoDB Atlas Connection String
22+
23+
To retrieve your connection string for the deployment that
24+
you created in the :ref:`previous step <laravel-quick-start-create-deployment>`,
25+
log in to your Atlas account and navigate to the
26+
:guilabel:`Database` section and click the :guilabel:`Connect` button
27+
for your new deployment.
28+
29+
.. figure:: /includes/figures/atlas_connection_select_cluster.png
30+
:alt: The connect button in the clusters section of the Atlas UI
31+
32+
Proceed to the :guilabel:`Connect your application` section and select
33+
"PHP" from the :guilabel:`Driver` selection menu and the version
34+
that best matches the version you installed from the :guilabel:`Version`
35+
selection menu.
36+
37+
Select the :guilabel:`Password (SCRAM)` authentication mechanism.
38+
39+
Deselect the :guilabel:`Include full driver code example` to view
40+
the connection string.
41+
42+
.. step:: Copy your Connection String
43+
44+
Click the button on the right of the connection string to copy it
45+
to your clipboard.
46+
47+
.. step:: Update the Placeholders
48+
49+
Paste this connection string into a a file in your preferred text editor
50+
and replace the ``<username>`` and ``<password>`` placeholders with
51+
your database user's username and password.
52+
53+
Save this file to a safe location for use in the next step.
54+
55+
After completing these steps, you have a connection string that
56+
contains your database username and password.
57+
58+
.. include:: /includes/quick-start/troubleshoot.rst
59+
60+
.. button:: Next: Connect to MongoDB
61+
:uri: /quick-start/connect-to-mongodb/
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _laravel-quick-start-create-deployment:
2+
3+
===========================
4+
Create a MongoDB Deployment
5+
===========================
6+
7+
You can create a free tier MongoDB deployment on MongoDB Atlas
8+
to store and manage your data. MongoDB Atlas hosts and manages
9+
your MongoDB database in the cloud.
10+
11+
.. procedure::
12+
:style: connected
13+
14+
.. step:: Create a Free MongoDB deployment on Atlas
15+
16+
Complete the :atlas:`Get Started with Atlas </getting-started?tck=docs_driver_laravel>`
17+
guide to set up a new Atlas account and load sample data into a new free
18+
tier MongoDB deployment.
19+
20+
.. step:: Save your Credentials
21+
22+
After you create your database user, save that user's
23+
username and password to a safe location for use in an upcoming step.
24+
25+
After you complete these steps, you have a new free tier MongoDB
26+
deployment on Atlas, database user credentials, and sample data loaded
27+
into your database.
28+
29+
.. note::
30+
31+
If you run into issues on this step, ask for help in the
32+
:community-forum:`MongoDB Community Forums <>`
33+
or submit feedback by using the :guilabel:`Share Feedback`
34+
tab on the right or bottom right side of this page.
35+
36+
.. button:: Next: Create a Connection String
37+
:uri: /quick-start/create-a-connection-string/
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.. _laravel-quick-start-download-and-install:
2+
3+
====================
4+
Download and Install
5+
=====================
6+
7+
.. facet::
8+
:name: genre
9+
:values: tutorial
10+
11+
.. meta::
12+
:keywords: php framework, odm, code example
13+
14+
Prerequisites
15+
-------------
16+
17+
This guide assumes that you have the following software installed:
18+
19+
- `PHP <https://www.php.net/downloads>`__
20+
- `Composer <https://getcomposer.org/>`__
21+
22+
.. procedure::
23+
:style: connected
24+
25+
.. step:: Install the MongoDB PHP Driver
26+
27+
.. step:: Install Laravel
28+
29+
.. step:: Add the {+odm-short+} Dependency
30+
31+
.. include:: /includes/quick-start/troubleshoot.rst
32+
33+
.. button:: Create a Deployment
34+
:uri: /quick-start/create-a-deployment/

docs/quick-start/next-steps.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.. _laravel-quick-start-next-steps:
2+
3+
==========
4+
Next Steps
5+
==========
6+
7+
.. facet::
8+
:name: genre
9+
:values: reference
10+
11+
.. meta::
12+
:keywords: learn more
13+
14+
Congratulations on completing the quick start tutorial!
15+
16+
In this tutorial, you created a Laravel web application that performs
17+
read and write database operations on a MongoDB deployment hostted on
18+
MongoDB Atlas.
19+
20+
Learn more about {+odm-short+} features from the following resources:
21+
22+
- :ref:`laravel-eloquent-models`: use Eloquent model classes to work
23+
with MongoDB data.
24+
25+
- :ref:`laravel-query-builder`: use the query builder to specify MongoDB
26+
queries and aggregations.

0 commit comments

Comments
 (0)