From f1e19b8cd5ccb77042660ef984df269ae764625e Mon Sep 17 00:00:00 2001 From: rustagir Date: Mon, 30 Sep 2024 16:45:53 -0400 Subject: [PATCH 1/3] DOCSP-42735: configure cxn --- source/quick-start-sinatra.txt | 2 +- .../quick-start-sinatra/configure-mongodb.txt | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 source/quick-start-sinatra/configure-mongodb.txt diff --git a/source/quick-start-sinatra.txt b/source/quick-start-sinatra.txt index 176b4efd..11814e03 100644 --- a/source/quick-start-sinatra.txt +++ b/source/quick-start-sinatra.txt @@ -57,8 +57,8 @@ that connects to a MongoDB deployment. /quick-start-sinatra/download-and-install/ /quick-start-sinatra/create-a-deployment/ /quick-start-sinatra/create-a-connection-string/ + /quick-start-sinatra/configure-mongodb/ -.. /quick-start-sinatra/configure-mongodb/ .. /quick-start-sinatra/view-data/ .. /quick-start-sinatra/write-data/ .. /quick-start-sinatra/next-steps/ diff --git a/source/quick-start-sinatra/configure-mongodb.txt b/source/quick-start-sinatra/configure-mongodb.txt new file mode 100644 index 00000000..905cac84 --- /dev/null +++ b/source/quick-start-sinatra/configure-mongodb.txt @@ -0,0 +1,54 @@ +.. _mongoid-quick-start-sinatra-connect-to-mongodb: + +================================= +Configure Your MongoDB Connection +================================= + +.. facet:: + :name: genre + :values: tutorial + +.. meta:: + :keywords: test connection, runnable, code example + +.. procedure:: + :style: connected + + .. step:: Specify target database in connection string + + When connecting to an Atlas cluster, you must specify the name of the + database that you want to interact with as the default database in your + connection string. + + We want to access the ``sample_restaurants`` database for this tutorial, + which you can add to your connection string **after the hostname**. + + For example, if the connection string for your Atlas cluster is + ``"mongodb+srv://user0:pass123@mongo0.example.com/"``, you can + specify the target database as shown in the following code: + + .. code-block:: none + + mongodb+srv://user0:pass123@mongo0.example.com/sample_restaurants + + .. step:: Specify connection + + In your project, create the ``config`` directory, then create a + file in this directory called ``mongoid.yml``. + + Paste the following configuration into the file, making sure to + replace the ```` placeholder with your connection + string that contains the target database: + + .. code-block:: yaml + :emphasize-lines: 4 + + development: + clients: + default: + uri: + +After completing these steps, your Sinatra web application is ready to +connect to MongoDB. + +.. include:: /includes/quick-start/troubleshoot.rst From a3997e002fd1180d01678760c4af530460efbc12 Mon Sep 17 00:00:00 2001 From: rustagir Date: Mon, 30 Sep 2024 16:54:01 -0400 Subject: [PATCH 2/3] small fix - vale --- source/quick-start-sinatra/configure-mongodb.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/quick-start-sinatra/configure-mongodb.txt b/source/quick-start-sinatra/configure-mongodb.txt index 905cac84..869458ba 100644 --- a/source/quick-start-sinatra/configure-mongodb.txt +++ b/source/quick-start-sinatra/configure-mongodb.txt @@ -16,13 +16,11 @@ Configure Your MongoDB Connection .. step:: Specify target database in connection string - When connecting to an Atlas cluster, you must specify the name of the - database that you want to interact with as the default database in your - connection string. + When connecting to an Atlas cluster, you must specify the database that + you want to interact with as the default database in your connection string. + You must add the database name to your connection string **after the hostname**. - We want to access the ``sample_restaurants`` database for this tutorial, - which you can add to your connection string **after the hostname**. - + We want to access the ``sample_restaurants`` database for this tutorial. For example, if the connection string for your Atlas cluster is ``"mongodb+srv://user0:pass123@mongo0.example.com/"``, you can specify the target database as shown in the following code: From 72559280dfab145f45f1f89e1eebd8be7b47c7fc Mon Sep 17 00:00:00 2001 From: rustagir Date: Tue, 1 Oct 2024 10:21:30 -0400 Subject: [PATCH 3/3] JS PR fixes 1 --- source/quick-start-sinatra/configure-mongodb.txt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source/quick-start-sinatra/configure-mongodb.txt b/source/quick-start-sinatra/configure-mongodb.txt index 869458ba..716104d1 100644 --- a/source/quick-start-sinatra/configure-mongodb.txt +++ b/source/quick-start-sinatra/configure-mongodb.txt @@ -20,10 +20,8 @@ Configure Your MongoDB Connection you want to interact with as the default database in your connection string. You must add the database name to your connection string **after the hostname**. - We want to access the ``sample_restaurants`` database for this tutorial. - For example, if the connection string for your Atlas cluster is - ``"mongodb+srv://user0:pass123@mongo0.example.com/"``, you can - specify the target database as shown in the following code: + The following example specifies the ``sample_restaurants`` target database + in a sample connection string: .. code-block:: none @@ -31,12 +29,12 @@ Configure Your MongoDB Connection .. step:: Specify connection - In your project, create the ``config`` directory, then create a - file in this directory called ``mongoid.yml``. + At the root level of your project, create a ``config`` directory. + Then, create a file in this directory called ``mongoid.yml``. - Paste the following configuration into the file, making sure to - replace the ```` placeholder with your connection - string that contains the target database: + Paste the following configuration into the ``mongoid.yml`` file, + making sure to replace the ```` placeholder + with your connection string that references the target database: .. code-block:: yaml :emphasize-lines: 4