diff --git a/config/redirects b/config/redirects
index b5c6f75d..4ffc9985 100644
--- a/config/redirects
+++ b/config/redirects
@@ -12,6 +12,7 @@ raw: ${prefix}/stable -> ${base}/current/
# General redirects
[v2.20-*]: ${prefix}/${version}/whats-new/ -> ${base}/${version}/reference/release-notes/
[v2.20-*]: ${prefix}/${version}/compatibility/ -> ${base}/${version}/reference/compatibility/
+[v2.20-*]: ${prefix}/${version}/getting-started/ -> ${base}/${version}/get-started/
# redirects for 2.15
@@ -124,3 +125,34 @@ raw: ${prefix}/stable -> ${base}/current/
(v2.20-*]: ${prefix}/${version}/reference/search-indexes/ -> ${base}/${version}/indexes/atlas-search-index/
(v2.20-*]: ${prefix}/${version}/reference/collations/ -> ${base}/${version}/read/collations/
(v2.20-*]: ${prefix}/${version}/contribute/ -> ${base}/${version}/issues-and-help/
+
+# Comprehensive coverage TOC shift
+
+(*-master) ${prefix}/${version}/get-started/download-and-install/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/get-started/create-a-deployment/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/get-started/create-a-connection-string/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/get-started/connect-to-mongodb/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/get-started/next-steps/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/databases-collections/ -> ${base}/${version}/get-started/
+(*-master) ${prefix}/${version}/write/insert/ -> ${base}/${version}/crud/insert/
+(*-master) ${prefix}/${version}/read/retrieve/ -> ${base}/${version}/crud/query/
+(*-master) ${prefix}/${version}/write/update/ -> ${base}/${version}/crud/update/
+(*-master) ${prefix}/${version}/write/replace/ -> ${base}/${version}/crud/replace/
+(*-master) ${prefix}/${version}/write/delete/ -> ${base}/${version}/crud/delete/
+(*-master) ${prefix}/${version}/write/bulk-write/ -> ${base}/${version}/crud/bulk-write/
+(*-master) ${prefix}/${version}/write/transactions/ -> ${base}/${version}/crud/transactions/
+(*-master) ${prefix}/${version}/read-write-pref/ -> ${base}/${version}/crud/configure-crud/
+(*-master) ${prefix}/${version}/read/collations/ -> ${base}/${version}/crud/collations/
+(*-master) ${prefix}/${version}/write/gridfs/ -> ${base}/${version}/crud/gridfs/
+(*-master) ${prefix}/${version}/read/count/ -> ${base}/${version}/crud/query/count
+(*-master) ${prefix}/${version}/read/retrieve/ -> ${base}/${version}/crud/query/find
+(*-master) ${prefix}/${version}/read/project/ -> ${base}/${version}/crud/query/project
+(*-master) ${prefix}/${version}/read/specify-documents-to-return/ -> ${base}/${version}/crud/query/specify-documents-to-return
+(*-master) ${prefix}/${version}/read/distinct/ -> ${base}/${version}/crud/query/distinct
+(*-master) ${prefix}/${version}/read/cursors/ -> ${base}/${version}/crud/query/cursors
+(*-master) ${prefix}/${version}/read/specify-a-query/ -> ${base}/${version}/crud/query/specify-a-query
+(*-master) ${prefix}/${version}/databases-collections/run-command -> ${base}/${version}/run-command
+(*-master) ${prefix}/${version}/monitoring/cluster-monitoring -> ${base}/${version}/logging-and-monitoring/cluster-monitoring
+(*-master) ${prefix}/${version}/read/change-streams/ -> ${base}/${version}/logging-and-monitoring/change-streams
+(*-master) ${prefix}/${version}/connect/tls/ -> ${base}/${version}/security/tls
+(*-master) ${prefix}/${version}/common-errors/ -> ${base}/${version}/
diff --git a/snooty.toml b/snooty.toml
index 1d847082..0c791726 100644
--- a/snooty.toml
+++ b/snooty.toml
@@ -1,12 +1,10 @@
name = "ruby-driver"
title = "Ruby Driver"
toc_landing_pages = [
- "/get-started",
- "/read",
- "/write",
+ "/connect/connection-options",
+ "/crud/query",
"/indexes",
- "/databases-collection",
- "/security/authentication",
+ "/security/authentication"
]
intersphinx = ["https://www.mongodb.com/docs/manual/objects.inv"]
@@ -23,7 +21,7 @@ mongo-enterprise = "MongoDB Enterprise Edition"
docs-branch = "master"
# always set this to the driver branch (i.e. 1.7 1.8, etc.)
version-number = "2.21"
-patch-version-number = "{+version-number+}.1"
+patch-version-number = "{+version-number+}.2"
version = "v{+version-number+}"
stable-api = "Stable API"
api-root = "https://www.mongodb.com/docs/ruby-driver/current/api/"
diff --git a/source/atlas-search.txt b/source/atlas-search.txt
new file mode 100644
index 00000000..9dc35706
--- /dev/null
+++ b/source/atlas-search.txt
@@ -0,0 +1,5 @@
+.. _ruby-atlas-search
+
+============
+Atlas Search
+============
diff --git a/source/connect.txt b/source/connect.txt
index 22eeab0b..6d64baec 100644
--- a/source/connect.txt
+++ b/source/connect.txt
@@ -23,9 +23,6 @@ Connect to MongoDB
:maxdepth: 1
Create a Client
- Stable API
Choose a Connection Target
Connection Options
- Configure TLS
- Limit Server Execution Time
AWS Lambda
diff --git a/source/connect/connection-options.txt b/source/connect/connection-options.txt
index 769ff176..afc0af98 100644
--- a/source/connect/connection-options.txt
+++ b/source/connect/connection-options.txt
@@ -17,6 +17,14 @@ Specify Connection Options
.. meta::
:keywords: connection string, URI, server, Atlas, settings, configure
+.. toctree::
+ :titlesonly:
+ :maxdepth: 1
+
+ Compress Network Traffic
+ Stable API
+ Limit Server Execution Time
+
Overview
--------
@@ -38,8 +46,8 @@ and the ``tls`` option with a value of ``true``:
uri = "mongodb://:/?connectTimeoutMS=60000&tls=true"
client = Mongo::Client.new(uri)
-Using a ``Mongo::Client``
-~~~~~~~~~~~~~~~~~~~~~~~~~
+Using a Mongo::Client
+~~~~~~~~~~~~~~~~~~~~~
You can pass connection options as arguments to the ``Mongo::Client`` constructor
instead of including them in your connection URI.
@@ -142,6 +150,14 @@ Server Selection
* - Connection Option
- Description
+ * - **:load_balanced**
+ - | Whether to expect to connect to a load balancer.
+ |
+ | **Data Type**: ``Boolean``
+ | **Default**: ``false``
+ | **Client Example**: ``load_balanced: { true }``
+ | **Connection URI Example**: N/A
+
* - **:server_selector**
- | Get the server selector. It either uses the read preference
defined in the client options or defaults to a Primary
diff --git a/source/connect/network-compression.txt b/source/connect/network-compression.txt
new file mode 100644
index 00000000..b1901893
--- /dev/null
+++ b/source/connect/network-compression.txt
@@ -0,0 +1,59 @@
+========================
+Compress Network Traffic
+========================
+
+.. meta::
+ :keywords: network compression, zlib, snappy, zstd, Ruby driver, connection string, URI, settings, configure
+
+.. contents:: On this page
+ :local:
+ :depth: 2
+
+Overview
+--------
+
+The {+driver-short+} supports network compression to reduce the amount
+of data transmitted between the client and the server.
+
+The driver supports the following compression algorithms:
+
+- `Snappy `__
+- `Zlib `__
+- `Zstandard `__
+
+
+If you specify multiple compression algorithms, the driver selects the first
+one in the list supported by your MongoDB instance.
+
+Specify Compression Algorithms
+------------------------------
+
+To enable compression for the connection to your MongoDB instance,
+specify the algorithms you want to use in one of the following ways:
+
+- Add the algorithms to your connection string as a parameter
+- Specify the algorithms in the ``compressors`` option of your ``Mongo::Client`` object
+
+.. tabs::
+
+ .. tab:: Connection String
+ :tabid: connection-string
+
+ To enable network compression by using the connection string, add the ``compressors`` option.
+ You can specify one or more algorithms as a comma-separated list.
+
+ .. literalinclude:: /includes/connect/network-compression.rb
+ :start-after: start-connection-string
+ :end-before: end-connection-string
+ :language: ruby
+
+ .. tab:: Client Settings
+ :tabid: client-settings
+
+ To enable compression in your Client object, pass the ``compressors`` option
+ to the ``Mongo::Client`` constructor.
+
+ .. literalinclude:: /includes/connect/network-compression.rb
+ :start-after: start-client-settings
+ :end-before: end-client-settings
+ :language: ruby
diff --git a/source/crud.txt b/source/crud.txt
new file mode 100644
index 00000000..b0056cc0
--- /dev/null
+++ b/source/crud.txt
@@ -0,0 +1,20 @@
+===============
+CRUD Operations
+===============
+
+.. toctree::
+ :titlesonly:
+ :maxdepth: 1
+
+ Insert Documents
+ Query Documents
+ Update Documents
+ Replace Documents
+ Delete Documents
+ Bulk Write Operations
+ Transactions
+ Configure CRUD Operations
+ Retryable Reads
+ Retryable Writes
+ Collation
+ Store Large Files
\ No newline at end of file
diff --git a/source/write/bulk-write.txt b/source/crud/bulk-write.txt
similarity index 100%
rename from source/write/bulk-write.txt
rename to source/crud/bulk-write.txt
diff --git a/source/read/collations.txt b/source/crud/collations.txt
similarity index 99%
rename from source/read/collations.txt
rename to source/crud/collations.txt
index c607409f..85df632a 100644
--- a/source/read/collations.txt
+++ b/source/crud/collations.txt
@@ -1,7 +1,7 @@
.. _ruby-collations:
==========
-Collations
+Collation
==========
.. default-domain:: mongodb
diff --git a/source/read-write-pref.txt b/source/crud/configure-crud.txt
similarity index 98%
rename from source/read-write-pref.txt
rename to source/crud/configure-crud.txt
index e6b6ea74..530beadd 100644
--- a/source/read-write-pref.txt
+++ b/source/crud/configure-crud.txt
@@ -1,8 +1,8 @@
.. _ruby-crud-write-read-pref:
-===============================
-CRUD Operations on Replica Sets
-===============================
+=========================
+Configure CRUD Operations
+=========================
.. facet::
:name: genre
diff --git a/source/write/delete.txt b/source/crud/delete.txt
similarity index 100%
rename from source/write/delete.txt
rename to source/crud/delete.txt
diff --git a/source/write/gridfs.txt b/source/crud/gridfs.txt
similarity index 100%
rename from source/write/gridfs.txt
rename to source/crud/gridfs.txt
diff --git a/source/write/insert.txt b/source/crud/insert.txt
similarity index 100%
rename from source/write/insert.txt
rename to source/crud/insert.txt
diff --git a/source/read.txt b/source/crud/query.txt
similarity index 91%
rename from source/read.txt
rename to source/crud/query.txt
index e8c6e83d..4233b52e 100644
--- a/source/read.txt
+++ b/source/crud/query.txt
@@ -1,8 +1,8 @@
.. _ruby-read:
-======================
-Read Data from MongoDB
-======================
+===============
+Query Documents
+===============
.. contents:: On this page
:local:
@@ -23,15 +23,27 @@ Read Data from MongoDB
:maxdepth: 1
Retrieve Data
- Specify a Query
Specify Documents to Return
Specify Fields to Return
Distinct Field Values
Count Documents
- Cursors
+ Access Data From a Cursor
Monitor Changes
Collations
+
+.. toctree::
+ :titlesonly:
+ :maxdepth: 1
+
+ Find Documents
+ Specify a Query
+ Specify Documents to Return
+ Specify Fields to Return
+ Count Documents
+ Distinct Field Values
+ Access Data from a Cursor
+
Overview
--------
diff --git a/source/read/count.txt b/source/crud/query/count.txt
similarity index 100%
rename from source/read/count.txt
rename to source/crud/query/count.txt
diff --git a/source/read/cursors.txt b/source/crud/query/cursors.txt
similarity index 100%
rename from source/read/cursors.txt
rename to source/crud/query/cursors.txt
diff --git a/source/read/distinct.txt b/source/crud/query/distinct.txt
similarity index 100%
rename from source/read/distinct.txt
rename to source/crud/query/distinct.txt
diff --git a/source/read/retrieve.txt b/source/crud/query/find.txt
similarity index 98%
rename from source/read/retrieve.txt
rename to source/crud/query/find.txt
index ccddb763..d513c25d 100644
--- a/source/read/retrieve.txt
+++ b/source/crud/query/find.txt
@@ -1,8 +1,8 @@
.. _ruby-retrieve:
-=============
-Retrieve Data
-=============
+==============
+Find Documents
+==============
.. contents:: On this page
:local:
@@ -15,7 +15,7 @@ Retrieve Data
:values: reference
.. meta::
- :keywords: code examples, read, query, cursor
+ :keywords: code examples, read, query, cursor, find
Overview
--------
diff --git a/source/read/project.txt b/source/crud/query/project.txt
similarity index 100%
rename from source/read/project.txt
rename to source/crud/query/project.txt
diff --git a/source/read/specify-a-query.txt b/source/crud/query/specify-a-query.txt
similarity index 100%
rename from source/read/specify-a-query.txt
rename to source/crud/query/specify-a-query.txt
diff --git a/source/read/specify-documents-to-return.txt b/source/crud/query/specify-documents-to-return.txt
similarity index 100%
rename from source/read/specify-documents-to-return.txt
rename to source/crud/query/specify-documents-to-return.txt
diff --git a/source/write/replace.txt b/source/crud/replace.txt
similarity index 100%
rename from source/write/replace.txt
rename to source/crud/replace.txt
diff --git a/source/crud/retryable-reads.txt b/source/crud/retryable-reads.txt
new file mode 100644
index 00000000..36ea1405
--- /dev/null
+++ b/source/crud/retryable-reads.txt
@@ -0,0 +1,18 @@
+.. _ruby-crud-retryable-reads:
+
+===============
+Retryable Reads
+===============
+
+.. facet::
+ :name: genre
+ :values: reference
+
+.. meta::
+ :keywords: timeout
+
+.. contents:: On this page
+ :local:
+ :backlinks: none
+ :depth: 2
+ :class: singlecol
\ No newline at end of file
diff --git a/source/crud/retryable-writes.txt b/source/crud/retryable-writes.txt
new file mode 100644
index 00000000..d1e2c93f
--- /dev/null
+++ b/source/crud/retryable-writes.txt
@@ -0,0 +1,18 @@
+.. _ruby-crud-retryable-writes:
+
+================
+Retryable Writes
+================
+
+.. facet::
+ :name: genre
+ :values: reference
+
+.. meta::
+ :keywords: timeout
+
+.. contents:: On this page
+ :local:
+ :backlinks: none
+ :depth: 2
+ :class: singlecol
\ No newline at end of file
diff --git a/source/write/transactions.txt b/source/crud/transactions.txt
similarity index 92%
rename from source/write/transactions.txt
rename to source/crud/transactions.txt
index fa815f63..6e86459a 100644
--- a/source/write/transactions.txt
+++ b/source/crud/transactions.txt
@@ -45,6 +45,35 @@ within the session.
created it. Using a session with a different ``Mongo::Client`` results in
operation errors.
+Causal Consistency
+~~~~~~~~~~~~~~~~~~
+
+.. sharedinclude:: dbx/causal-consistency.rst
+
+ .. replacement:: insert-one-method
+
+ ``insert_one()``
+
+ .. replacement:: update-one-method
+
+ ``update_one()``
+
+ .. replacement:: find-one-method
+
+ ``find()``
+
+ .. replacement:: delete-one-method
+
+ ``delete_one()``
+
+ .. replacement:: majority-rc
+
+ ``:majority``
+
+ .. replacement:: majority-wc
+
+ ``:majority``
+
Methods
-------
diff --git a/source/write/update.txt b/source/crud/update.txt
similarity index 93%
rename from source/write/update.txt
rename to source/crud/update.txt
index e766bfa4..2ba6b0b4 100644
--- a/source/write/update.txt
+++ b/source/crud/update.txt
@@ -105,6 +105,19 @@ where the value of the ``name`` field is ``"Starbucks"``. The update document us
11 document(s) updated
+Upsert Option
+~~~~~~~~~~~~~
+
+The ``upsert`` parameter allows you to use the ``update_one()`` and
+``update_many()`` operations to perform a conditional operation:
+
+- If the specified document exists, the command updates it.
+- If the specified document does not exist, the command creates a new document
+ with the specified parameter.
+
+For more information, see the :ref:`` section or the :ref:`options
+table ` on this page.
+
Customize the Update Operation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -117,6 +130,8 @@ operation with default settings.
The following table describes the options that you can use to
configure the update operation:
+.. _ruby-update-options-table:
+
.. list-table::
:widths: 30 70
:header-rows: 1
@@ -161,6 +176,8 @@ configure the update operation:
` in the
{+mdb-server+} manual.
+.. _ruby-upsert-example:
+
Modify Update Example
`````````````````````
diff --git a/source/data-formats.txt b/source/data-formats.txt
index 5af1d6ef..442b2cae 100644
--- a/source/data-formats.txt
+++ b/source/data-formats.txt
@@ -24,6 +24,7 @@ Data Formats
Time Series Data
BSON
+ Extended JSON
Overview
--------
diff --git a/source/data-formats/extended-json.txt b/source/data-formats/extended-json.txt
new file mode 100644
index 00000000..9e9f47f5
--- /dev/null
+++ b/source/data-formats/extended-json.txt
@@ -0,0 +1,103 @@
+.. _ruby-extended-json:
+
+=============
+Extended JSON
+=============
+
+.. facet::
+ :name: genre
+ :values: reference
+
+.. meta::
+ :keywords: code example, json, standard formatting
+ :description: Learn how to use extended JSON in the MongoDB Ruby Driver.
+
+.. contents:: On this page
+ :local:
+ :backlinks: none
+ :depth: 2
+ :class: twocols
+
+.. sharedinclude:: dbx/extended-json.rst
+
+Read Extended JSON
+------------------
+
+You can read an Extended JSON string into an Ruby array by calling
+the ``BSON::ExtJSON.parse`` method. This method parses an Extended
+JSON string and returns an array containing the data.
+
+The following example shows how you can read an Extended JSON string into a
+array of hashes by using the ``parse`` method:
+
+.. io-code-block::
+ :copyable:
+
+ .. input:: /includes/data-formats/extended-json.rb
+ :start-after: start-ex-json-read
+ :end-before: end-ex-json-read
+ :language: ruby
+ :dedent:
+
+ .. output::
+ :language: none
+ :visible: false
+
+ {"foo" => [1, 2]}
+ {"bar" => {"hello" => "world"}}
+ {"code" => #}
+ {"bin" => }
+
+Write Extended JSON
+-------------------
+
+You can write an Extended JSON string by using the ``as_extended_json``
+method. By default, this method returns the Extended JSON string in canonical
+format, but you can specify relaxed or legacy formats by passing a ``mode`` argument.
+
+.. note:: Legacy Version
+
+ The legacy format option tells the {+driver-short+} to serialize BSON types
+ with the MongoDB Extended JSON v1 format, which predates the current
+ relaxed and canonical formats.
+
+ For more information see, the :manual:`MongoDB Extended JSON v1
+ ` page in the Server manual.
+
+The ``as_extended_json`` method is available for several core and standard
+library types, including ``Array`` and ``Hash``. The following example creates
+Extended JSON strings in the canonical, relaxed, and legacy formats, from an
+array of hashes:
+
+.. io-code-block::
+ :copyable:
+
+ .. input:: /includes/data-formats/extended-json.rb
+ :start-after: start-ex-json-write
+ :end-before: end-ex-json-write
+ :language: ruby
+ :dedent:
+
+ .. output::
+ :language: none
+ :visible: false
+
+ canonical: [{"foo":[{"$numberInt":"1"},{"$numberInt":"2"}]},{"bin":{"$binary":{"base64":"AQIDBA==","subType":"80"}}},{"number":{"$numberLong":"42"}}]
+ relaxed: [{"foo":[1,2]},{"bin":{"$binary":{"base64":"AQIDBA==","subType":"80"}}},{"number":42}]
+ legacy: [{"foo":[1,2]},{"bin":{"$binary":"AQIDBA==","$type":"80"}},{"number":42}]
+
+Additional Information
+----------------------
+
+For more information, see the following resources:
+
+API Documentation
+~~~~~~~~~~~~~~~~~
+
+- `BSON::ExtJSON.parse `__
+- `#as_extended_json `__
+
+Server Manual Pages
+~~~~~~~~~~~~~~~~~~~
+
+- :manual:`MongoDB Extended JSON (v2)`
\ No newline at end of file
diff --git a/source/databases-collection.txt b/source/databases-collection.txt
deleted file mode 100644
index 9aadd2ce..00000000
--- a/source/databases-collection.txt
+++ /dev/null
@@ -1,264 +0,0 @@
-.. _ruby-databases-collections:
-
-=========================
-Databases and Collections
-=========================
-
-.. contents:: On this page
- :local:
- :backlinks: none
- :depth: 2
- :class: singlecol
-
-.. facet::
- :name: genre
- :values: reference
-
-.. meta::
- :keywords: table, row, organize, storage
-
-.. toctree::
- :titlesonly:
- :maxdepth: 1
-
- Run a Command
-
-Overview
---------
-
-In this guide, you can learn how to use MongoDB databases and
-collections with {+driver-short+}.
-
-MongoDB organizes data into a hierarchy of the following levels:
-
-- **Databases**: The top level of data organization in a MongoDB instance.
-- **Collections**: MongoDB stores documents in collections. They are analogous to tables in relational databases.
-- **Documents**: Contain literal data such as string, numbers, dates, and other embedded documents.
-
-For more information about document field types and structure, see the
-:manual:`Documents ` guide in the {+mdb-server+} manual.
-
-.. TODO: Add a diagram here
-
-Access a Database
------------------
-
-Access a database by creating a ``Mongo::Client`` instance with the desired
-database name.
-
-The following example accesses a database named ``test_database``:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-access-db
- :end-before: end-access-db
-
-
-Access a Collection
--------------------
-
-Access a collection by using the ``[]`` method on an instance
-of your database.
-
-The following example accesses a collection named ``test_collection``:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :emphasize-lines: 2
- :start-after: start-access-cl
- :end-before: end-access-cl
-
-.. tip::
-
- If the provided collection name does not already exist in the database,
- MongoDB implicitly creates the collection when you first insert data
- into it.
-
-Create a Collection
--------------------
-
-While the Ruby driver for MongoDB does not have a direct ``create_collection``
-method, you can use the ``create`` method to create a collection with
-specific options.
-
-The following example creates a collection called example_collection with
-specific options:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :emphasize-lines: 3
- :start-after: start-create-collection
- :end-before: end-create-collection
-
-You can specify collection options such as maximum size, document validation
-rules, and others by passing them as arguments to the command method with the
-create command. For a full list of optional parameters, refer to the MongoDB
-documentation on the :manual:`create command `.
-
-Get a List of Collections
--------------------------
-
-You can query for a list of collections in a database by calling the ``collections``
-method. This method returns an array of collection objects in the database.
-
-The following example calls the ``collections`` method and iterates over the array
-to print the results:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-get-list
- :end-before: end-get-list
-
-To query for only the names of the collections in the database, call the
-``collection_names`` method as follows:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-get-list-names
- :end-before: end-get-list-names
-
-.. note::
-
- The ``database.collections`` objects list provides more detailed information
- (i.e. each collection object can be further queried for metadata), while
- ``database.collection_names`` simply lists the collection names.
-
-Delete a Collection
--------------------
-
-You can delete a collection from the database by using the ``drop`` method.
-
-The following example deletes the ``test_collection`` collection:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-delete
- :end-before: end-delete
-
-.. warning:: Dropping a Collection Deletes All Data in the Collection
-
- Dropping a collection from your database permanently deletes all
- documents and all indexes within that collection.
-
- Drop a collection only if the data in it is no longer needed.
-
-.. _ruby-config-read-write:
-
-Configure Read and Write Operations
------------------------------------
-
-You can control how the driver routes read operations by setting a **read preference**.
-You can also control options for how the driver waits for acknowledgment of
-read and write operations on a replica set by setting a **read concern** and a
-**write concern**.
-
-By default, databases inherit these settings from the ``Mongo::Client`` instance,
-and collections inherit them from the database. However, you can change these
-settings on your database or collection by using one of the following methods:
-
-- ``database.with``: Gets the database and applies the new read preference, read
- concern, and write concern.
-- ``collection.with``: Gets the collection and applies the new read preference,
- read concern, and write concern.
-
-To change read or write settings with the preceding methods, call the method and
-pass in the new read preference, read concern, or write concern.
-
-The following example shows how to change the read preference, read concern, and
-write preference of a database called ``test-database`` with the ``database.with``
-method:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-with-database
- :end-before: end-with-database
-
-The following example shows how to change the read preference, read concern, and
-write concern of a collection:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-with-collection
- :end-before: end-with-collection
-
-To learn more about the read and write settings, see the following guides in the
-MongoDB Server manual:
-
-- :manual:`Read Preference `
-- :manual:`Read Concern `
-- :manual:`Write Concern `
-
-Tag Sets
-~~~~~~~~
-
-In {+mdb-server+}, you can apply key-value :manual:`tags
-` to replica set
-members according to any criteria you choose. You can then use
-those tags to target one or more members for a read operation.
-
-By default, the MongoDB {+driver-short+} selects primary members for read operations.
-You can modify this behavior by setting read preferences and, optionally, tag sets.
-
-In the following code example, the tag set passed to the ``:read`` parameter
-instructs the {+driver-short+} to prefer reads from the New York data center
-(``'dc':'ny'``) and to fall back to the San Francisco data center (``'dc':'sf'``):
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-tag-sets
- :end-before: end-tag-sets
-
-To learn more about replica sets, see the the MongoDB Server manual
-:manual:`Replica Set Members ` page.
-
-Local Threshold
-~~~~~~~~~~~~~~~
-
-If multiple replica set members match the read preference and tag sets you specify,
-{+driver-short+} reads from the nearest replica set members of sharded clusters,
-chosen according to their ping time.
-
-By default, the driver uses only those members whose ping times are within 15 milliseconds
-of the nearest member for queries. To distribute reads between members with
-higher latencies, pass the ``local_threshold`` option to the ``Mongo::Client`` constructor.
-
-The following example specifies a local threshold of 35 milliseconds:
-
-.. literalinclude:: /includes/usage-examples/databases-collection.rb
- :language: ruby
- :dedent:
- :start-after: start-local-threshold-example
- :end-before: end-local-threshold-example
- :emphasize-lines: 5
-
-In the preceding example, {+driver-short+} distributes reads between matching members
-within 35 milliseconds of the closest member's ping time.
-
-.. note::
-
- {+driver-short+} ignores the value of ``local_threshold`` when communicating with a
- replica set through a ``mongos`` instance. In this case, use the
- :manual:`localThreshold `
- command-line option.
-
-API Documentation
------------------
-
-To learn more about any of the methods or types discussed in this
-guide, see the following API documentation:
-
-- :ruby-api:`collections `
-- :ruby-api:`collection_names `
-- :ruby-api:`command `
-- :ruby-api:`drop database `
-- :ruby-api:`drop collection `
-- :ruby-api:`with `
diff --git a/source/get-started.txt b/source/get-started.txt
index bb100e54..92df65b4 100644
--- a/source/get-started.txt
+++ b/source/get-started.txt
@@ -7,7 +7,7 @@ Get Started with the Ruby Driver
.. contents:: On this page
:local:
:backlinks: none
- :depth: 2
+ :depth: 3
:class: singlecol
.. facet::
@@ -16,15 +16,7 @@ Get Started with the Ruby Driver
.. meta::
:description: Learn how to create an app to connect to MongoDB deployment by using the Ruby driver.
- :keywords: quick start, tutorial, basics
-
-.. toctree::
-
- Download & Install
- Create a Deployment
- Create a Connection String
- Connect to MongoDB
- Next Steps
+ :keywords: quick start, tutorial, basics, installation, setup, code example, test connection, runnable
Overview
--------
@@ -44,3 +36,454 @@ and query data in your cluster.
If you prefer to use a different driver or programming language to connect to
MongoDB, see our :driver:`list of official drivers <>`.
+.. include:: /includes/get-started/troubleshoot.rst
+
+.. _ruby-quick-start-download-and-install:
+
+Download and Install
+--------------------
+
+.. procedure::
+ :style: connected
+
+ .. step:: Install dependencies
+
+ Before you begin developing, ensure you install `Ruby
+ `__ version 2.7
+ or later in your development environment. {+language+}
+ is pre-installed on macOS and some Linux distributions,
+ but you might need to update your version.
+
+ .. important::
+
+ The {+driver-short+} is not officially supported on Windows.
+
+ .. step:: Create a project directory
+
+ Run the following command in your shell to create a directory
+ called ``ruby-quickstart`` for this project:
+
+ .. code-block:: bash
+
+ mkdir ruby-quickstart
+
+ Then, run the following commands to create a ``quickstart.rb`` file in
+ the ``ruby-quickstart`` directory:
+
+ .. code-block:: bash
+
+ cd ruby-quickstart
+ touch quickstart.rb
+
+ .. step:: Add the {+driver-short+} to your project
+
+ Open the ``quickstart.rb`` file and add the following code:
+
+ .. literalinclude:: /includes/get-started/quickstart.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-bundler
+ :end-before: end-bundler
+
+ This code adds the {+driver-short+} as a dependency by
+ using the `Bundler `__ dependency management tool.
+
+After you complete these steps, you have a new project directory with the driver
+dependencies installed.
+
+.. _ruby-get-started-create-deployment:
+
+Create a MongoDB Deployment
+---------------------------
+
+You can create a free tier MongoDB deployment on MongoDB Atlas
+to store and manage your data. MongoDB Atlas hosts and manages
+your MongoDB database in the cloud.
+
+.. procedure::
+ :style: connected
+
+ .. step:: Create a free MongoDB deployment on Atlas
+
+ Complete the :atlas:`Get Started with Atlas `
+ guide to set up a new Atlas account and load sample data into a new free
+ tier MongoDB deployment.
+
+ .. step:: Save your credentials
+
+ After you create your database user, save that user's
+ username and password to a safe location for use in an upcoming step.
+
+After you complete these steps, you have a new free tier MongoDB
+deployment on Atlas, database user credentials, and sample data loaded
+in your database.
+
+.. _ruby-get-started-connection-string:
+
+Create a Connection String
+--------------------------
+
+You can connect to your MongoDB deployment by providing a
+**connection URI**, also called a *connection string*, which
+instructs the driver how to connect to a MongoDB deployment
+and how to behave while connected.
+
+The connection string includes the hostname or IP address and
+port of your deployment, the authentication mechanism, user credentials
+when applicable, and connection options.
+
+To learn how to connect to an instance or deployment not hosted on
+Atlas, see the :ref:`ruby-connection-targets` guide.
+
+.. procedure::
+ :style: connected
+
+ .. step:: Find your MongoDB Atlas connection string
+
+ To retrieve your connection string for the deployment that
+ you created in the :ref:`previous step `,
+ log in to your Atlas account and navigate to the
+ :guilabel:`Clusters` section. Then, click the :guilabel:`Connect` button
+ for your new deployment.
+
+ .. figure:: /includes/figures/atlas_connection_connect_cluster.png
+ :alt: The connect button in the clusters section of the Atlas UI
+
+ Proceed to the :guilabel:`Connect your application` section. Select
+ "Ruby" from the :guilabel:`Driver` selection menu and the version
+ that best matches your installed version from the :guilabel:`Version`
+ selection menu.
+
+ .. step:: Copy your connection string
+
+ Click the copy button on the right of the connection string to copy it to
+ your clipboard, as shown in the following screenshot:
+
+ .. figure:: /includes/figures/atlas_connection_copy_string_ruby.png
+ :alt: The connection string copy button in the Atlas UI
+
+ .. step:: Update the placeholders
+
+ Paste this connection string into a file in your preferred text editor
+ and replace the ```` and ```` placeholders with
+ your database user's username and password.
+
+ Save this file to a safe location for use in the next step.
+
+After completing these steps, you have a connection string that
+contains your database username and password.
+
+.. _ruby-get-started-connect-to-mongodb:
+
+Connect to MongoDB
+------------------
+
+.. procedure::
+ :style: connected
+
+ .. step:: Edit your {+language+} application file
+
+ Navigate to your ``quickstart.rb`` file in the ``ruby-quickstart``
+ directory. Copy and paste the following code below the Bundler
+ code from the :ref:`ruby-quick-start-download-and-install` step
+ of this tutorial. This code connects to MongoDB and queries the
+ ``movies`` collection in the ``sample_mflix`` database.
+
+ .. literalinclude:: /includes/get-started/quickstart.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-query
+ :end-before: end-query
+
+ .. step:: Assign the connection string
+
+ Replace the ```` placeholder with the
+ connection string that you copied from the :ref:`ruby-get-started-connection-string`
+ step of this tutorial.
+
+ .. step:: Run your {+language+} application
+
+ From your ``ruby-quickstart`` directory, run the following shell
+ command to run the application:
+
+ .. code-block:: none
+
+ ruby quickstart.rb
+
+ The command line output contains details about the retrieved movie
+ document:
+
+ .. code-block:: none
+ :copyable: false
+
+ {"_id"=>BSON::ObjectId('...'), "plot"=>"A young man is accidentally sent
+ 30 years into the past in a time-traveling DeLorean invented by his friend,
+ Dr. Emmett Brown, and must make sure his high-school-age parents unite
+ in order to save his own existence.", ...
+ "title"=>"Back to the Future", ...
+
+ If you encounter an error or see no output, ensure that you specified the
+ correct connection string in the ``quickstart.rb`` file and that you loaded the
+ sample data.
+
+After you complete these steps, you have a working application that
+uses the driver to connect to your MongoDB deployment, runs a query on
+the sample data, and prints out the result.
+
+.. _ruby-databases-collections:
+
+Manage your Databases and Collections
+-------------------------------------
+
+You can learn how to use MongoDB databases and
+collections with {+driver-short+}.
+
+MongoDB organizes data into a hierarchy of the following levels:
+
+- **Databases**: The top level of data organization in a MongoDB instance.
+- **Collections**: MongoDB stores documents in collections. They are analogous to tables in relational databases.
+- **Documents**: Contain literal data such as string, numbers, dates, and other embedded documents.
+
+For more information about document field types and structure, see the
+:manual:`Documents ` guide in the {+mdb-server+} manual.
+
+.. TODO: Add a diagram here
+
+Access a Database
+~~~~~~~~~~~~~~~~~
+
+Access a database by creating a ``Mongo::Client`` instance with the desired
+database name.
+
+The following example accesses a database named ``test_database``:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-access-db
+ :end-before: end-access-db
+
+
+Access a Collection
+~~~~~~~~~~~~~~~~~~~
+
+Access a collection by using the ``[]`` method on an instance
+of your database.
+
+The following example accesses a collection named ``test_collection``:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :emphasize-lines: 2
+ :start-after: start-access-cl
+ :end-before: end-access-cl
+
+.. tip::
+
+ If the provided collection name does not already exist in the database,
+ MongoDB implicitly creates the collection when you first insert data
+ into it.
+
+Create a Collection
+~~~~~~~~~~~~~~~~~~~
+
+While the Ruby driver for MongoDB does not have a direct ``create_collection``
+method, you can use the ``create`` method to create a collection with
+specific options.
+
+The following example creates a collection called example_collection with
+specific options:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :emphasize-lines: 3
+ :start-after: start-create-collection
+ :end-before: end-create-collection
+
+You can specify collection options such as maximum size, document validation
+rules, and others by passing them as arguments to the command method with the
+create command. For a full list of optional parameters, refer to the MongoDB
+documentation on the :manual:`create command `.
+
+Get a List of Collections
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can query for a list of collections in a database by calling the ``collections``
+method. This method returns an array of collection objects in the database.
+
+The following example calls the ``collections`` method and iterates over the array
+to print the results:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-get-list
+ :end-before: end-get-list
+
+To query for only the names of the collections in the database, call the
+``collection_names`` method as follows:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-get-list-names
+ :end-before: end-get-list-names
+
+.. note::
+
+ The ``database.collections`` objects list provides more detailed information
+ (i.e. each collection object can be further queried for metadata), while
+ ``database.collection_names`` simply lists the collection names.
+
+Delete a Collection
+~~~~~~~~~~~~~~~~~~~
+
+You can delete a collection from the database by using the ``drop`` method.
+
+The following example deletes the ``test_collection`` collection:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-delete
+ :end-before: end-delete
+
+.. warning:: Dropping a Collection Deletes All Data in the Collection
+
+ Dropping a collection from your database permanently deletes all
+ documents and all indexes within that collection.
+
+ Drop a collection only if the data in it is no longer needed.
+
+.. _ruby-config-read-write:
+
+Configure Read and Write Operations
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can control how the driver routes read operations by setting a **read preference**.
+You can also control options for how the driver waits for acknowledgment of
+read and write operations on a replica set by setting a **read concern** and a
+**write concern**.
+
+By default, databases inherit these settings from the ``Mongo::Client`` instance,
+and collections inherit them from the database. However, you can change these
+settings on your database or collection by using one of the following methods:
+
+- ``database.with``: Gets the database and applies the new read preference, read
+ concern, and write concern.
+- ``collection.with``: Gets the collection and applies the new read preference,
+ read concern, and write concern.
+
+To change read or write settings with the preceding methods, call the method and
+pass in the new read preference, read concern, or write concern.
+
+The following example shows how to change the read preference, read concern, and
+write preference of a database called ``test-database`` with the ``database.with``
+method:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-with-database
+ :end-before: end-with-database
+
+The following example shows how to change the read preference, read concern, and
+write concern of a collection:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-with-collection
+ :end-before: end-with-collection
+
+To learn more about the read and write settings, see the following guides in the
+MongoDB Server manual:
+
+- :manual:`Read Preference `
+- :manual:`Read Concern `
+- :manual:`Write Concern `
+
+Tag Sets
+````````
+
+In {+mdb-server+}, you can apply key-value :manual:`tags
+` to replica set
+members according to any criteria you choose. You can then use
+those tags to target one or more members for a read operation.
+
+By default, the MongoDB {+driver-short+} selects primary members for read operations.
+You can modify this behavior by setting read preferences and, optionally, tag sets.
+
+In the following code example, the tag set passed to the ``:read`` parameter
+instructs the {+driver-short+} to prefer reads from the New York data center
+(``'dc':'ny'``) and to fall back to the San Francisco data center (``'dc':'sf'``):
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-tag-sets
+ :end-before: end-tag-sets
+
+To learn more about replica sets, see the the MongoDB Server manual
+:manual:`Replica Set Members ` page.
+
+Local Threshold
+````````````````
+
+If multiple replica set members match the read preference and tag sets you specify,
+{+driver-short+} reads from the nearest replica set members of sharded clusters,
+chosen according to their ping time.
+
+By default, the driver uses only those members whose ping times are within 15 milliseconds
+of the nearest member for queries. To distribute reads between members with
+higher latencies, pass the ``local_threshold`` option to the ``Mongo::Client`` constructor.
+
+The following example specifies a local threshold of 35 milliseconds:
+
+.. literalinclude:: /includes/usage-examples/databases-collection.rb
+ :language: ruby
+ :dedent:
+ :start-after: start-local-threshold-example
+ :end-before: end-local-threshold-example
+ :emphasize-lines: 5
+
+In the preceding example, {+driver-short+} distributes reads between matching members
+within 35 milliseconds of the closest member's ping time.
+
+.. note::
+
+ {+driver-short+} ignores the value of ``local_threshold`` when communicating with a
+ replica set through a ``mongos`` instance. In this case, use the
+ :manual:`localThreshold `
+ command-line option.
+
+API Documentation
+~~~~~~~~~~~~~~~~~
+
+To learn more about any of the methods or types discussed in this
+guide, see the following API documentation:
+
+- :ruby-api:`collections `
+- :ruby-api:`collection_names `
+- :ruby-api:`command `
+- :ruby-api:`drop database `
+- :ruby-api:`drop collection `
+- :ruby-api:`with `
+
+.. _ruby-get-started-next-steps:
+
+Next Steps
+----------
+
+Congratulations on completing the quick start tutorial!
+
+In this tutorial, you created a {+language+} application that
+connects to a MongoDB deployment hosted on MongoDB Atlas
+and retrieves a document that matches a query.
+
+Learn more about the {+driver-short+} from the following resources:
+
+- Learn how to perform read operations in the :ref:`` section.
+- Learn how to perform write operations in the :ref:`` section.
diff --git a/source/get-started/connect-to-mongodb.txt b/source/get-started/connect-to-mongodb.txt
deleted file mode 100644
index 40702b27..00000000
--- a/source/get-started/connect-to-mongodb.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-.. _ruby-get-started-connect-to-mongodb:
-
-==================
-Connect to MongoDB
-==================
-
-.. facet::
- :name: genre
- :values: tutorial
-
-.. meta::
- :keywords: test connection, runnable, code example
-
-.. procedure::
- :style: connected
-
- .. step:: Edit your {+language+} application file
-
- Navigate to your ``quickstart.rb`` file in the ``ruby-quickstart``
- directory. Copy and paste the following code below the Bundler
- code from the :ref:`ruby-quick-start-download-and-install` step
- of this tutorial. This code connects to MongoDB and queries the
- ``movies`` collection in the ``sample_mflix`` database.
-
- .. literalinclude:: /includes/get-started/quickstart.rb
- :language: ruby
- :dedent:
- :start-after: start-query
- :end-before: end-query
-
- .. step:: Assign the connection string
-
- Replace the ```` placeholder with the
- connection string that you copied from the :ref:`ruby-get-started-connection-string`
- step of this tutorial.
-
- .. step:: Run your {+language+} application
-
- From your ``ruby-quickstart`` directory, run the following shell
- command to run the application:
-
- .. code-block:: none
-
- ruby quickstart.rb
-
- The command line output contains details about the retrieved movie
- document:
-
- .. code-block:: none
- :copyable: false
-
- {"_id"=>BSON::ObjectId('...'), "plot"=>"A young man is accidentally sent
- 30 years into the past in a time-traveling DeLorean invented by his friend,
- Dr. Emmett Brown, and must make sure his high-school-age parents unite
- in order to save his own existence.", ...
- "title"=>"Back to the Future", ...
-
- If you encounter an error or see no output, ensure that you specified the
- correct connection string in the ``quickstart.rb`` file and that you loaded the
- sample data.
-
-After you complete these steps, you have a working application that
-uses the driver to connect to your MongoDB deployment, runs a query on
-the sample data, and prints out the result.
-
-.. include:: /includes/get-started/troubleshoot.rst
diff --git a/source/get-started/create-a-connection-string.txt b/source/get-started/create-a-connection-string.txt
deleted file mode 100644
index 89e373e2..00000000
--- a/source/get-started/create-a-connection-string.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-.. _ruby-get-started-connection-string:
-
-==========================
-Create a Connection String
-==========================
-
-You can connect to your MongoDB deployment by providing a
-**connection URI**, also called a *connection string*, which
-instructs the driver how to connect to a MongoDB deployment
-and how to behave while connected.
-
-The connection string includes the hostname or IP address and
-port of your deployment, the authentication mechanism, user credentials
-when applicable, and connection options.
-
-To learn how to connect to an instance or deployment not hosted on
-Atlas, see the :ref:`ruby-connection-targets` guide.
-
-.. procedure::
- :style: connected
-
- .. step:: Find your MongoDB Atlas connection string
-
- To retrieve your connection string for the deployment that
- you created in the :ref:`previous step `,
- log in to your Atlas account and navigate to the
- :guilabel:`Clusters` section. Then, click the :guilabel:`Connect` button
- for your new deployment.
-
- .. figure:: /includes/figures/atlas_connection_connect_cluster.png
- :alt: The connect button in the clusters section of the Atlas UI
-
- Proceed to the :guilabel:`Connect your application` section. Select
- "Ruby" from the :guilabel:`Driver` selection menu and the version
- that best matches your installed version from the :guilabel:`Version`
- selection menu.
-
- .. step:: Copy your connection string
-
- Click the copy button on the right of the connection string to copy it to
- your clipboard, as shown in the following screenshot:
-
- .. figure:: /includes/figures/atlas_connection_copy_string_ruby.png
- :alt: The connection string copy button in the Atlas UI
-
- .. step:: Update the placeholders
-
- Paste this connection string into a file in your preferred text editor
- and replace the ```` and ```` placeholders with
- your database user's username and password.
-
- Save this file to a safe location for use in the next step.
-
-After completing these steps, you have a connection string that
-contains your database username and password.
-
-.. include:: /includes/get-started/troubleshoot.rst
\ No newline at end of file
diff --git a/source/get-started/create-a-deployment.txt b/source/get-started/create-a-deployment.txt
deleted file mode 100644
index e19b53c1..00000000
--- a/source/get-started/create-a-deployment.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-.. _ruby-get-started-create-deployment:
-
-===========================
-Create a MongoDB Deployment
-===========================
-
-You can create a free tier MongoDB deployment on MongoDB Atlas
-to store and manage your data. MongoDB Atlas hosts and manages
-your MongoDB database in the cloud.
-
-.. procedure::
- :style: connected
-
- .. step:: Create a free MongoDB deployment on Atlas
-
- Complete the :atlas:`Get Started with Atlas `
- guide to set up a new Atlas account and load sample data into a new free
- tier MongoDB deployment.
-
- .. step:: Save your credentials
-
- After you create your database user, save that user's
- username and password to a safe location for use in an upcoming step.
-
-After you complete these steps, you have a new free tier MongoDB
-deployment on Atlas, database user credentials, and sample data loaded
-in your database.
-
-.. include:: /includes/get-started/troubleshoot.rst
\ No newline at end of file
diff --git a/source/get-started/download-and-install.txt b/source/get-started/download-and-install.txt
deleted file mode 100644
index 18090fb6..00000000
--- a/source/get-started/download-and-install.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-.. _ruby-quick-start-download-and-install:
-
-====================
-Download and Install
-====================
-
-.. facet::
- :name: genre
- :values: tutorial
-
-.. meta::
- :keywords: installation, setup, code example
-
-.. procedure::
- :style: connected
-
- .. step:: Install dependencies
-
- Before you begin developing, ensure you install `Ruby
- `__ version 2.7
- or later in your development environment. {+language+}
- is pre-installed on macOS and some Linux distributions,
- but you might need to update your version.
-
- .. important::
-
- The {+driver-short+} is not officially supported on Windows.
-
- .. step:: Create a project directory
-
- Run the following command in your shell to create a directory
- called ``ruby-quickstart`` for this project:
-
- .. code-block:: bash
-
- mkdir ruby-quickstart
-
- Then, run the following commands to create a ``quickstart.rb`` file in
- the ``ruby-quickstart`` directory:
-
- .. code-block:: bash
-
- cd ruby-quickstart
- touch quickstart.rb
-
- .. step:: Add the {+driver-short+} to your project
-
- Open the ``quickstart.rb`` file and add the following code:
-
- .. literalinclude:: /includes/get-started/quickstart.rb
- :language: ruby
- :dedent:
- :start-after: start-bundler
- :end-before: end-bundler
-
- This code adds the {+driver-short+} as a dependency by
- using the `Bundler `__ dependency management tool.
-
-After you complete these steps, you have a new project directory with the driver
-dependencies installed.
-
-.. include:: /includes/get-started/troubleshoot.rst
diff --git a/source/get-started/next-steps.txt b/source/get-started/next-steps.txt
deleted file mode 100644
index f47a193b..00000000
--- a/source/get-started/next-steps.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-.. _ruby-get-started-next-steps:
-
-==========
-Next Steps
-==========
-
-.. facet::
- :name: genre
- :values: reference
-
-.. meta::
- :keywords: learn more
-
-Congratulations on completing the quick start tutorial!
-
-In this tutorial, you created a {+language+} application that
-connects to a MongoDB deployment hosted on MongoDB Atlas
-and retrieves a document that matches a query.
-
-Learn more about the {+driver-short+} from the following resources:
-
-- Learn how to perform read operations in the :ref:`` section.
-- Learn how to perform write operations in the :ref:`` section.
\ No newline at end of file
diff --git a/source/includes/connect/network-compression.rb b/source/includes/connect/network-compression.rb
new file mode 100644
index 00000000..65281115
--- /dev/null
+++ b/source/includes/connect/network-compression.rb
@@ -0,0 +1,9 @@
+# start-connection-string
+uri = "mongodb://:/?compressors=zlib,snappy"
+client = Mongo::Client.new(uri)
+# end-connection-string
+
+# start-client-settings
+client = Mongo::Client.new([":"],
+ compressors: ["zlib", "snappy"])
+# end-client-settings
\ No newline at end of file
diff --git a/source/includes/data-formats/extended-json.rb b/source/includes/data-formats/extended-json.rb
new file mode 100644
index 00000000..a93a59e5
--- /dev/null
+++ b/source/includes/data-formats/extended-json.rb
@@ -0,0 +1,39 @@
+# start-ex-json-read
+require 'bson'
+
+ex_json = '''[
+ {"foo": [1, 2]},
+ {"bar": {"hello": "world"}},
+ {"code": {
+ "$scope": {},
+ "$code": "function x() { return 1; }"
+ }},
+ {"bin": {
+ "$type": "80",
+ "$binary": "AQIDBA=="
+ }}
+ ]'''
+
+doc = BSON::ExtJSON.parse(ex_json)
+
+puts doc.class
+puts doc
+# end-ex-json-read
+
+# start-ex-json-write
+require 'bson'
+
+hash_array = [
+ { "foo" => [1, 2] },
+ { "bin" => BSON::Binary.new("\x01\x02\x03\x04", :user) },
+ { "number" => BSON::Int64.new(42) }
+]
+
+json_string_canonical = hash_array.as_extended_json
+json_string_relaxed = hash_array.as_extended_json(mode: :relaxed)
+json_string_legacy = hash_array.as_extended_json(mode: :legacy)
+
+puts "canonical:\t #{json_string_canonical}"
+puts "relaxed:\t #{json_string_relaxed}"
+puts "legacy:\t\t #{json_string_legacy}"
+# end-ex-json-write
\ No newline at end of file
diff --git a/source/includes/get-started/troubleshoot.rst b/source/includes/get-started/troubleshoot.rst
index 6860d7be..fdabbf7e 100644
--- a/source/includes/get-started/troubleshoot.rst
+++ b/source/includes/get-started/troubleshoot.rst
@@ -1,6 +1,6 @@
.. note::
- If you run into issues on this step, ask for help in the
+ If you run into issues getting started, ask for help in the
:community-forum:`MongoDB Community Forums `
or submit feedback by using the :guilabel:`Rate this page`
tab on the right side of this page.
\ No newline at end of file
diff --git a/source/index.txt b/source/index.txt
index f237301f..0619af58 100644
--- a/source/index.txt
+++ b/source/index.txt
@@ -17,20 +17,18 @@
Get Started
Connect
- Databases & Collections
- Read Data
- Write Data
- Operations on Replica Sets
+ CRUD Operations
+ Aggregation
+ Data Formats
Indexes
- Monitor Your Application
- Data Aggregation
- {+avs+}
+ Run a Database Command
+ Atlas Search
+ Atlas Vector Search
+ Logging and Monitoring
Security
- Data Formats
- API Documentation <{+api-root+}>
Reference
+ API Documentation <{+api-root+}>
Issues & Help
- Common Errors
Introduction
------------
diff --git a/source/logging-and-monitoring.txt b/source/logging-and-monitoring.txt
new file mode 100644
index 00000000..8a2b57ab
--- /dev/null
+++ b/source/logging-and-monitoring.txt
@@ -0,0 +1,13 @@
+.. _ruby-logging-monitoring
+
+======================
+Logging and Monitoring
+======================
+
+.. toctree::
+ :titlesonly:
+ :maxdepth: 1
+
+ Logging
+ Monitoring
+ Change Streams
diff --git a/source/read/change-streams.txt b/source/logging-and-monitoring/change-streams.txt
similarity index 100%
rename from source/read/change-streams.txt
rename to source/logging-and-monitoring/change-streams.txt
diff --git a/source/logging-and-monitoring/logging.txt b/source/logging-and-monitoring/logging.txt
new file mode 100644
index 00000000..dfeac0c6
--- /dev/null
+++ b/source/logging-and-monitoring/logging.txt
@@ -0,0 +1,5 @@
+.. _ruby-logging:
+
+========
+Logging
+========
diff --git a/source/monitoring/cluster-monitoring.txt b/source/logging-and-monitoring/monitoring.txt
similarity index 99%
rename from source/monitoring/cluster-monitoring.txt
rename to source/logging-and-monitoring/monitoring.txt
index c30dcd7c..9650ca3d 100644
--- a/source/monitoring/cluster-monitoring.txt
+++ b/source/logging-and-monitoring/monitoring.txt
@@ -1,8 +1,8 @@
.. _ruby-cluster-monitoring:
-==================
-Cluster Monitoring
-==================
+==========
+Monitoring
+==========
.. facet::
:name: genre
diff --git a/source/reference.txt b/source/reference.txt
index 0129ab17..0b9e3059 100644
--- a/source/reference.txt
+++ b/source/reference.txt
@@ -12,8 +12,8 @@ Reference
:maxdepth: 1
Release Notes
- Upgrade Versions
Compatibility
+ Upgrade Versions
View the Source
- :ref:`Release Notes `
diff --git a/source/databases-collections/run-command.txt b/source/run-command.txt
similarity index 100%
rename from source/databases-collections/run-command.txt
rename to source/run-command.txt
diff --git a/source/security.txt b/source/security.txt
index d1d745f6..1709a513 100644
--- a/source/security.txt
+++ b/source/security.txt
@@ -20,5 +20,6 @@ Security
.. toctree::
:titlesonly:
+ TLS
Authentication
In-Use Encryption
\ No newline at end of file
diff --git a/source/connect/tls.txt b/source/security/tls.txt
similarity index 100%
rename from source/connect/tls.txt
rename to source/security/tls.txt
diff --git a/source/vector-search.txt b/source/vector-search.txt
index 593783f7..ab9e670f 100644
--- a/source/vector-search.txt
+++ b/source/vector-search.txt
@@ -1,8 +1,8 @@
.. _ruby-atlas-vector-search:
-================================
-Run an {+avs+} Query
-================================
+===================
+Atlas Vector Search
+===================
.. facet::
:name: genre