@@ -10,3 +10,84 @@ Quick Start
1010 :depth: 2
1111 :class: singlecol
1212
13+ .. include:: /includes/quick-start/overview.rst
14+
15+ Set up Your Project
16+ -------------------
17+
18+ Initialize with Go Mod
19+ ~~~~~~~~~~~~~~~~~~~~~~
20+
21+ Create a new directory and initialize your project with ``go mod``.
22+
23+ .. code-block:: shell
24+
25+ mkdir go-quickstart
26+ cd go-quickstart
27+ go mod init go-quickstart
28+
29+ .. _add-mongodb-dependency:
30+
31+ Add MongoDB as a Dependency
32+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
33+
34+ Use ``go get`` to add the Go driver as a dependency.
35+
36+ .. code-block:: shell
37+
38+ go get go.mongodb.org/mongo-driver/mongo
39+
40+ Create a MongoDB Cluster
41+ ------------------------
42+
43+ .. include:: /includes/quick-start/atlas-setup.rst
44+
45+
46+ Query Your MongoDB Cluster from Your Application
47+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48+
49+ Next, create a file to contain your application called ``main.go``
50+ in the base directory of your project. Use the following sample
51+ code to run a query on your sample dataset in MongoDB Atlas.
52+
53+ Set the value of the ``uri`` variable with your MongoDB Atlas connection
54+ string, or create an environmental variable with the name ``MONGODB_URI``
55+ with your Atlas connection string.
56+
57+ .. code-block:: sh
58+
59+ export MONGODB_URI='<your atlas connection string>'
60+
61+ .. note::
62+
63+ Make sure to replace the "<password>" section of the connection string with
64+ the password you created for your user that has **atlasAdmin** permissions:
65+
66+ .. literalinclude:: /includes/quick-start/main.go
67+ :language: go
68+ :dedent:
69+
70+ Run the sample code with the following command from your command line:
71+
72+ .. code-block:: shell
73+
74+ go run main.go
75+
76+
77+ .. include:: /includes/quick-start/query-output.rst
78+
79+ .. tip::
80+
81+ If your output is empty, ensure you have loaded the
82+ :atlas:`sample datasets </sample-data/>` into your cluster.
83+
84+ After completing this step, you should have a working application that uses
85+ the Go driver to connect to your MongoDB cluster, run a query on the
86+ sample data, and print out the result.
87+
88+
89+
90+ Next steps
91+ ----------
92+
93+ .. include:: /includes/quick-start/next-steps.rst
0 commit comments