diff --git a/source/archive-reference-files/fundamentals/auth.txt b/source/archive-reference-files/fundamentals/auth.txt index eda165ad..967f6bd9 100644 --- a/source/archive-reference-files/fundamentals/auth.txt +++ b/source/archive-reference-files/fundamentals/auth.txt @@ -33,7 +33,6 @@ The Go driver supports the following authentication mechanisms: * :ref:`SCRAM-SHA-256 ` * :ref:`SCRAM-SHA-1 ` -* :ref:`MONGODB-CR ` * :ref:`MongoDB-AWS ` * :ref:`X.509 ` @@ -63,33 +62,17 @@ Each authentication mechanism contains the following placeholders: authentication data. If you omit this option, the driver uses the default value ``admin``. +.. _golang_sha_256: .. _golang-default-auth-mechanism: -Default -~~~~~~~ - -The default mechanism uses one of the following authentication -mechanisms depending on what MongoDB versions your server supports: - -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - :class: compatibility-large - - * - Mechanism - - Versions - - * - ``SCRAM-SHA-256`` - - MongoDB 4.0 and later - - * - ``SCRAM-SHA-1`` - - MongoDB 3.0, 3.2, 3.4, and 3.6 +``SCRAM-SHA-256`` +~~~~~~~~~~~~~~~~~ - * - ``MONGODB-CR`` - - MongoDB 2.6 and earlier +``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism +(SCRAM) that uses your database username and password, encrypted with the ``SHA-256`` +algorithm, to authenticate your user. This is the default authentication mechanism. -To specify the default authentication mechanism, omit the -``AuthMechanism`` option: +To specify this default authentication mechanism, omit the ``AuthMechanism`` option: .. code-block:: go @@ -103,26 +86,8 @@ To specify the default authentication mechanism, omit the client, err := mongo.Connect(clientOpts) -To learn more about the challenge-response (CR) and salted -challenge-response authentication mechanisms (SCRAM) that MongoDB supports, -see the :manual:`SCRAM ` section of the server manual. - -.. _golang_sha_256: - -``SCRAM-SHA-256`` -~~~~~~~~~~~~~~~~~ - -.. important:: - - ``SCRAM-SHA-256`` is the default authentication method for MongoDB starting - in MongoDB 4.0. - -``SCRAM-SHA-256`` is a salted challenge-response authentication mechanism -(SCRAM) that uses your database username and password, encrypted with the ``SHA-256`` -algorithm, to authenticate your user. - -To specify the ``SCRAM-SHA-256`` authentication mechanism, assign the -``AuthMechanism`` option the value ``"SCRAM-SHA-256"``: +You can also explicitly specify the ``SCRAM-SHA-256`` authentication mechanism +by assigning the ``AuthMechanism`` option the value ``"SCRAM-SHA-256"``: .. code-block:: go :emphasize-lines: 2 @@ -138,17 +103,15 @@ To specify the ``SCRAM-SHA-256`` authentication mechanism, assign the client, err := mongo.Connect(clientOpts) +To learn more about the challenge-response authentication mechanisms (SCRAM) that MongoDB supports, +see the :manual:`SCRAM ` section of the Server manual. + .. _golang-scram-sha-1-auth-mechanism: .. _golang-sha-1: ``SCRAM-SHA-1`` ~~~~~~~~~~~~~~~ -.. important:: - - ``SCRAM-SHA-1`` is the default authentication method for MongoDB versions - 3.0, 3.2, 3.4, and 3.6. - ``SCRAM-SHA-1`` is a salted challenge-response mechanism (SCRAM) that uses your username and password, encrypted using the ``SHA-1`` algorithm, to authenticate your user. @@ -170,29 +133,11 @@ To specify the ``SCRAM-SHA-1`` authentication mechanism, assign the client, err := mongo.Connect(clientOpts) -.. _golang-mongodb-cr: - -``MONGODB-CR`` -~~~~~~~~~~~~~~ - -``MONGODB-CR`` is a challenge-response authentication mechanism that uses your -username and password to authenticate your user. - -.. important:: - - This authentication mechanism was deprecated starting in MongoDB 3.6 - and is no longer supported as of MongoDB 4.0. - .. _golang-mongodb-aws: ``MONGODB-AWS`` ~~~~~~~~~~~~~~~ -.. important:: - - The MONGODB-AWS authentication mechanism is available only in MongoDB - versions 4.4 and later. - The ``MONGODB-AWS`` authentication mechanism uses your Amazon Web Services Identity and Access Management (AWS IAM) credentials to authenticate your user. diff --git a/source/archive-reference-files/fundamentals/crud/read-operations/skip.txt b/source/archive-reference-files/fundamentals/crud/read-operations/skip.txt index d7ad895b..a5d34f3d 100644 --- a/source/archive-reference-files/fundamentals/crud/read-operations/skip.txt +++ b/source/archive-reference-files/fundamentals/crud/read-operations/skip.txt @@ -5,8 +5,6 @@ Skip Returned Results .. meta:: :description: Learn how to skip a specified number of results in MongoDB read operations using the setSkip() method or the $skip stage in aggregation pipelines. -.. default-domain:: mongodb - .. contents:: On this page :local: :backlinks: none diff --git a/source/archive-reference-files/fundamentals/crud/read-operations/sort.txt b/source/archive-reference-files/fundamentals/crud/read-operations/sort.txt index 4b44a237..9462f6ce 100644 --- a/source/archive-reference-files/fundamentals/crud/read-operations/sort.txt +++ b/source/archive-reference-files/fundamentals/crud/read-operations/sort.txt @@ -5,8 +5,6 @@ Sort Results .. meta:: :description: Learn how to sort query results, handle ties, and apply sorting in aggregation pipelines with the MongoDB Go Driver. -.. default-domain:: mongodb - .. contents:: On this page :local: :backlinks: none diff --git a/source/archive-reference-files/usage-examples/command.txt b/source/archive-reference-files/usage-examples/command.txt index c8242586..5718e1b5 100644 --- a/source/archive-reference-files/usage-examples/command.txt +++ b/source/archive-reference-files/usage-examples/command.txt @@ -6,8 +6,6 @@ Run a Command Example .. meta:: :description: Learn how to execute commands on a MongoDB server using the runCommand() method in Go, with an example retrieving database statistics. -.. default-domain:: mongodb - You can run commands directly on your MongoDB server by using the ``RunCommand()`` method. diff --git a/source/archive-reference-files/usage-examples/deleteMany.txt b/source/archive-reference-files/usage-examples/deleteMany.txt index 05984844..788d4e9e 100644 --- a/source/archive-reference-files/usage-examples/deleteMany.txt +++ b/source/archive-reference-files/usage-examples/deleteMany.txt @@ -5,9 +5,7 @@ Delete Multiple Documents ========================= .. meta:: - :description: Learn how to delete multiple documents from a collection using the deleteMany() method in the MongoDB Go Driver. - -.. default-domain:: mongodb + :description: Learn how to delete multiple documents from a collection using the DeleteMany() method in the MongoDB Go Driver. You can delete multiple documents in a collection by using the ``DeleteMany()`` method. diff --git a/source/archive-reference-files/usage-examples/deleteOne.txt b/source/archive-reference-files/usage-examples/deleteOne.txt index bd0baba3..46f29095 100644 --- a/source/archive-reference-files/usage-examples/deleteOne.txt +++ b/source/archive-reference-files/usage-examples/deleteOne.txt @@ -5,7 +5,7 @@ Delete a Document ================= .. meta:: - :description: Learn how to delete a document from a collection using the deleteOne() method in the MongoDB Go Driver. + :description: Learn how to delete a document from a collection using the DeleteOne() method in the MongoDB Go Driver. You can delete a document in a collection by using the ``DeleteOne()`` method. diff --git a/source/archive-reference-files/usage-examples/findOne.txt b/source/archive-reference-files/usage-examples/findOne.txt index b7b86617..aadac355 100644 --- a/source/archive-reference-files/usage-examples/findOne.txt +++ b/source/archive-reference-files/usage-examples/findOne.txt @@ -4,9 +4,7 @@ Find a Document =============== .. meta:: - :description: Retrieve a single document from a collection using the findOne() method in the MongoDB Go Driver. - -.. default-domain:: mongodb + :description: Retrieve a single document from a collection using the FindOne() method in the MongoDB Go Driver. You can retrieve a single document from a collection by using the ``FindOne()`` method. diff --git a/source/archive-reference-files/usage-examples/insertMany.txt b/source/archive-reference-files/usage-examples/insertMany.txt index 87550ff9..1a63c443 100644 --- a/source/archive-reference-files/usage-examples/insertMany.txt +++ b/source/archive-reference-files/usage-examples/insertMany.txt @@ -5,9 +5,7 @@ Insert Multiple Documents ========================= .. meta:: - :description: Learn how to insert multiple documents into a collection using the insertMany() method in the MongoDB Go Driver. - -.. default-domain:: mongodb + :description: Learn how to insert multiple documents into a collection using the InsertMany() method in the MongoDB Go Driver. You can insert multiple documents into a collection by using the ``InsertMany()`` method. diff --git a/source/archive-reference-files/usage-examples/insertOne.txt b/source/archive-reference-files/usage-examples/insertOne.txt index 25cae79e..827d2d06 100644 --- a/source/archive-reference-files/usage-examples/insertOne.txt +++ b/source/archive-reference-files/usage-examples/insertOne.txt @@ -5,9 +5,7 @@ Insert a Document Example ========================= .. meta:: - :description: Learn how to insert a document into a collection using the insertOne() method in the MongoDB Go Driver. - -.. default-domain:: mongodb + :description: Learn how to insert a document into a collection using the InsertOne() method in the MongoDB Go Driver. You can insert a document into a collection by using the ``InsertOne()`` method. diff --git a/source/archive-reference-files/usage-examples/replaceOne.txt b/source/archive-reference-files/usage-examples/replaceOne.txt index 953dc92a..087887b3 100644 --- a/source/archive-reference-files/usage-examples/replaceOne.txt +++ b/source/archive-reference-files/usage-examples/replaceOne.txt @@ -5,9 +5,7 @@ Replace a Document ================== .. meta:: - :description: Learn how to replace a document in a MongoDB collection using the replaceOne() method with the MongoDB Go Driver. - -.. default-domain:: mongodb + :description: Learn how to replace a document in a MongoDB collection using the ReplaceOne() method with the MongoDB Go Driver. You can replace a document in a collection by using the ``ReplaceOne()`` method. diff --git a/source/archive-reference-files/usage-examples/updateMany.txt b/source/archive-reference-files/usage-examples/updateMany.txt index eb2a2e4f..b4b1e7d3 100644 --- a/source/archive-reference-files/usage-examples/updateMany.txt +++ b/source/archive-reference-files/usage-examples/updateMany.txt @@ -5,7 +5,7 @@ Update Multiple Documents ========================= .. meta:: - :description: Learn how to update multiple documents in a collection using the updateMany() method in the MongoDB Go Driver. + :description: Learn how to update multiple documents in a collection using the UpdateMany() method in the MongoDB Go Driver. You can update multiple documents in a collection by using the ``UpdateMany()`` method. diff --git a/source/archive-reference-files/usage-examples/updateOne.txt b/source/archive-reference-files/usage-examples/updateOne.txt index 919fb98c..3b54bdc9 100644 --- a/source/archive-reference-files/usage-examples/updateOne.txt +++ b/source/archive-reference-files/usage-examples/updateOne.txt @@ -5,7 +5,7 @@ Update a Document ================= .. meta:: - :description: Learn how to update a document in a collection using the updateOne() method in the MongoDB Go Driver. + :description: Learn how to update a document in a collection using the UpdateOne() method in the MongoDB Go Driver. You can update a document in a collection by using the ``UpdateOne()`` method. diff --git a/source/connect.txt b/source/connect.txt index 606918cc..1bdc5a3d 100644 --- a/source/connect.txt +++ b/source/connect.txt @@ -42,4 +42,4 @@ sections: - :ref:`golang-connection-troubleshooting` For more information about authenticating with a MongoDB instance, see the -:ref:`golang-authentication` section. \ No newline at end of file +:ref:`golang-authentication` section. diff --git a/source/connect/connection-options/connection-pools.txt b/source/connect/connection-options/connection-pools.txt index b246d2e6..52eb4a56 100644 --- a/source/connect/connection-options/connection-pools.txt +++ b/source/connect/connection-options/connection-pools.txt @@ -242,4 +242,4 @@ guide, see the following API documentation: - `Client <{+api+}/mongo#Client>`__ - `ClientOptions <{+api+}/mongo/options#ClientOptions>`__ -- `Client.Diconnect() <{+api+}/mongo#Client.Disconnect>`__ \ No newline at end of file +- `Client.Diconnect() <{+api+}/mongo#Client.Disconnect>`__ diff --git a/source/connect/connection-options/network-compression.txt b/source/connect/connection-options/network-compression.txt index ae9285ae..c0dad717 100644 --- a/source/connect/connection-options/network-compression.txt +++ b/source/connect/connection-options/network-compression.txt @@ -23,11 +23,11 @@ your application. The {+driver-short+} supports the following compression algorithms: -1. `Snappy `__: available in MongoDB 3.4 and later. +1. `Snappy `__ -2. `Zlib `__: available in MongoDB 3.6 and later. +#. `Zlib `__ -3. `Zstandard `__: available in MongoDB 4.2 and later. +#. `Zstandard `__ If you specify multiple compression algorithms, the driver selects the first one in the list supported by your MongoDB deployment. diff --git a/source/connect/connection-options/server-selection.txt b/source/connect/connection-options/server-selection.txt new file mode 100644 index 00000000..ac55fa3e --- /dev/null +++ b/source/connect/connection-options/server-selection.txt @@ -0,0 +1 @@ +.. TODO \ No newline at end of file diff --git a/source/connect/connection-options/stable-api.txt b/source/connect/connection-options/stable-api.txt index 46b853b8..7d56cc11 100644 --- a/source/connect/connection-options/stable-api.txt +++ b/source/connect/connection-options/stable-api.txt @@ -7,8 +7,6 @@ .. meta:: :description: Learn how to specify Stable API compatibility in the MongoDB Go Driver to ensure operations align with a defined API version. -.. default-domain:: mongodb - .. contents:: On this page :local: :backlinks: none @@ -152,4 +150,4 @@ API Documentation: - `ServerAPIOptions <{+api+}/mongo/options#ServerAPIOptions>`__ - `ServerApiVersion <{+api+}/mongo/options#ServerAPIVersion>`__ - `SetDeprecationErrors() <{+api+}/mongo/options#ServerAPIOptions.SetDeprecationErrors>`__ -- `SetStrict() <{+api+}/mongo/options#ServerAPIOptions.SetStrict>`__ \ No newline at end of file +- `SetStrict() <{+api+}/mongo/options#ServerAPIOptions.SetStrict>`__ diff --git a/source/crud/bulk.txt b/source/crud/bulk.txt index 7daf6963..c63431bf 100644 --- a/source/crud/bulk.txt +++ b/source/crud/bulk.txt @@ -7,8 +7,6 @@ Bulk Operations .. meta:: :description: Learn to perform bulk write operations with the MongoDB Go Driver, including inserts, updates, replacements, and deletions, using the bulkWrite() method. -.. default-domain:: mongodb - .. contents:: On this page :local: :backlinks: none @@ -811,4 +809,5 @@ see the following API documentation: - `NewClientUpdateOneModel() <{+api+}/mongo#NewClientUpdateOneModel>`__ - `NewClientUpdateManyModel() <{+api+}/mongo#NewClientUpdateManyModel>`__ - `NewClientDeleteOneModel() <{+api+}/mongo#NewClientDeleteOneModel>`__ -- `NewClientDeleteManyModel() <{+api+}/mongo#NewClientDeleteManyModel>`__ \ No newline at end of file +- `NewClientDeleteManyModel() + <{+api+}/mongo#NewClientDeleteManyModel>`__ diff --git a/source/crud/compound-operations.txt b/source/crud/compound-operations.txt index e2a95cb8..652b05bd 100644 --- a/source/crud/compound-operations.txt +++ b/source/crud/compound-operations.txt @@ -7,8 +7,6 @@ Compound Operations .. meta:: :description: Learn how to perform compound operations in MongoDB using Go, combining read and write actions into a single atomic operation to prevent data alteration. -.. default-domain:: mongodb - .. contents:: On this page :local: :backlinks: none @@ -78,22 +76,22 @@ the specified query filter and deletes it. The method returns a The ``FindOneAndDelete()`` method is an atomic operation, which means it prevents any other write operations from changing the matching document until it - completes. The ``deleteOne()`` method is also an atomic operation, but differs from + completes. The ``DeleteOne()`` method is also an atomic operation, but differs from ``FindOneAndDelete()`` in that you cannot specify a sort order for the matched documents. To find a document and delete it in separate operations, call the - ``findOne()`` method followed by the ``deleteOne()`` method. + ``FindOne()`` method followed by the ``DeleteOne()`` method. Modify Behavior ~~~~~~~~~~~~~~~ You can modify the behavior of the ``FindOneAndDelete()`` method by -passing in a ``FineOneAndDeleteOptions``. If you don't specify a -``FineOneAndDeleteOptions``, the driver uses the default values for each +passing in a ``FindOneAndDeleteOptions``. If you don't specify a +``FindOneAndDeleteOptions``, the driver uses the default values for each option. -The ``FineOneAndDeleteOptions`` type allows you to configure options +The ``FindOneAndDeleteOptions`` type allows you to configure options with the following methods: .. list-table:: @@ -163,22 +161,22 @@ document. The ``FindOneAndUpdate()`` method is an atomic operation, which means it prevents any other write operations from changing the matching document until it - completes. The ``updateOne()`` method is also an atomic operation, but differs from - ``FindOneAndUpdate()`` in that you cannot specify a sort order for the - matched documents. + completes. The ``UpdateOne()`` method is also an atomic operation, but differs from + ``FindOneAndUpdate()`` because you cannot return the pre-image of the + updated document when using ``UpdateOne()``. To find a document and update it in separate operations, call - the ``findOne()`` method followed by the ``updateOne()`` method. + the ``FindOne()`` method followed by the ``UpdateOne()`` method. Modify Behavior ~~~~~~~~~~~~~~~ You can modify the behavior of the ``FindOneAndUpdate()`` method by -passing in a ``FineOneAndUpdateOptions``. If you don't specify a -``FineOneAndUpdateOptions``, the driver uses the default values for each +passing in a ``FindOneAndUpdateOptions``. If you don't specify a +``FindOneAndUpdateOptions``, the driver uses the default values for each option. -The ``FineOneAndUpdateOptions`` type allows you to configure options +The ``FindOneAndUpdateOptions`` type allows you to configure options with the following methods: .. list-table:: @@ -276,11 +274,11 @@ Modify Behavior ~~~~~~~~~~~~~~~ You can modify the behavior of the ``FindOneAndReplace()`` method by -passing in a ``FineOneAndReplaceOptions``. If you don't specify a -``FineOneAndReplaceOptions``, the driver uses the default values for each +passing in a ``FindOneAndReplaceOptions``. If you don't specify a +``FindOneAndReplaceOptions``, the driver uses the default values for each option. -The ``FineOneAndReplaceOptions`` type allows you to configure options +The ``FindOneAndReplaceOptions`` type allows you to configure options with the following methods: .. list-table:: diff --git a/source/crud/configure.txt b/source/crud/configure.txt index f14d19cd..760e725c 100644 --- a/source/crud/configure.txt +++ b/source/crud/configure.txt @@ -625,4 +625,4 @@ API Documentation: - `CreateOne() <{+api+}/mongo#IndexView.CreateOne>`__ - `IndexOptions <{+api+}/mongo/options#IndexOptions>`__ - `UpdateOneOptions <{+api+}/mongo/options#UpdateOneOptions>`__ -- `UpdateManyOptions <{+api+}/mongo/options#UpdateManyOptions>`__ \ No newline at end of file +- `UpdateManyOptions <{+api+}/mongo/options#UpdateManyOptions>`__ diff --git a/source/crud/delete.txt b/source/crud/delete.txt index 890b7a30..1f816754 100644 --- a/source/crud/delete.txt +++ b/source/crud/delete.txt @@ -6,7 +6,7 @@ Delete Documents ================ .. meta:: - :description: Learn how to remove documents from collections with the deleteOne() and deleteMany() methods in the MongoDB Go Driver, with examples and options. + :description: Learn how to remove documents from collections with the DeleteOne() and DeleteMany() methods in the MongoDB Go Driver, with examples and options. .. contents:: On this page :local: diff --git a/source/crud/insert.txt b/source/crud/insert.txt index df8e2a9f..f9fec9b4 100644 --- a/source/crud/insert.txt +++ b/source/crud/insert.txt @@ -10,7 +10,7 @@ Insert Documents .. meta:: :keywords: code example, write operation, add data - :description: Learn how to insert documents into a MongoDB collection using the insertOne() and insertMany() methods, with options to modify their behavior. + :description: Learn how to insert documents into a MongoDB collection using the InsertOne() and InsertMany() methods, with options to modify their behavior. .. contents:: On this page :local: diff --git a/source/crud/transactions.txt b/source/crud/transactions.txt index 1b00bc57..c37594c5 100644 --- a/source/crud/transactions.txt +++ b/source/crud/transactions.txt @@ -160,6 +160,14 @@ options, then creates a session with these options: .. sharedinclude:: dbx/transactions-parallelism.rst + .. replacement:: driver-specific-content + + If your application is connected to {+mdb-server+} v8.0 or later, + you can perform write operations on multiple namespaces within a + single transaction by using the client bulk write feature. To + learn more, see the :ref:`golang-bulk-client` section of the Bulk + Operations guide. + Example ------- @@ -211,4 +219,4 @@ guide, see the following API Documentation: - `StartSession() <{+api+}/mongo#Client.StartSession>`__ - `TransactionOptions <{+api+}/mongo/options#TransactionOptions>`__ - `SetWriteConcern() <{+api+}/mongo/options#TransactionOptionsBuilder.SetWriteConcern>`__ -- `InsertMany() <{+api+}/mongo#Collection.InsertMany>`__ \ No newline at end of file +- `InsertMany() <{+api+}/mongo#Collection.InsertMany>`__ diff --git a/source/data-formats/bson.txt b/source/data-formats/bson.txt index 2cadcb55..15952230 100644 --- a/source/data-formats/bson.txt +++ b/source/data-formats/bson.txt @@ -348,11 +348,63 @@ user-defined struct by using methods from the ``bson`` package: You can use the ``Raw`` type to retrieve elements from a BSON document byte slice without unmarshalling it to a Go type. This type allows you to look up individual elements without unmarshalling - the entire BSON document. + the entire BSON document. For more information about how to use the ``Raw`` type, see + the :ref:`golang-bson-raw` section. To learn more about the marshalling and unmarshalling methods used with the -``Cursor`` type, see the `Cursor API documentation <{+api+}/mongo#Cursor>`__ +``Cursor`` type, see the `Cursor API documentation <{+api+}/mongo#Cursor>`__. To learn more about the marshalling and unmarshalling methods in the ``bson`` package, see the `bson API documentation -<{+api+}/bson#hdr-Marshalling_and_Unmarshalling>`_ +<{+api+}/bson#hdr-Marshalling_and_Unmarshalling>`_. + +.. _golang-bson-raw: + +Work with Raw BSON Data +----------------------- + +The {+driver-short+} supports working with raw BSON documents through the ``Raw`` type. The ``Raw`` +type allows you to validate and retrieve elements from a slice of bytes without unmarshalling +the entire BSON document. This is useful in the following situations: + +- Performing lookups on specific fields without converting the entire document +- Reducing memory overhead by avoiding full document unmarshalling +- Working directly with binary BSON data received from the database + +The ``Raw`` type provides methods to validate the BSON document and look up individual +elements by their keys. The following example demonstrates how to validate a raw BSON document and retrieve +a specific field from it: + +.. io-code-block:: + :copyable: true + + .. input:: + :language: go + + collection := client.Database("sample_restaurants").Collection("restaurants") + findOptions := options.FindOne() + var raw bson.Raw + err = collection.FindOne( + context.TODO(), + bson.D{{"name", "Mongo's Pizza"}}, + findOptions, + ).Decode(&raw) + if err != nil { + log.Fatalf("Failed to find document: %v", err) + } + + // Print the document type + fmt.Printf("Document type: %T\n", raw) + + // Access a field from the raw document + name := raw.Lookup("name").StringValue() + fmt.Println("Restaurant name:", name) + + .. output:: + :language: none + :visible: false + + Document type: bson.Raw + Restaurant name: Mongo's Pizza + +To learn more about the ``Raw`` family of types, see the `Raw BSON API documentation <{+api+}/bson#hdr-Raw_BSON>`__. diff --git a/source/databases-collections.txt b/source/databases-collections.txt index 8a2b26a9..b572319c 100644 --- a/source/databases-collections.txt +++ b/source/databases-collections.txt @@ -142,4 +142,4 @@ following API documentation: - `Collection <{+api+}/mongo#Collection>`__ - `CreateCollection() <{+api+}/mongo#Database.CreateCollection>`__ - `ListCollections() <{+api+}/mongo#Database.ListCollections>`__ -- `Drop() <{+api+}/mongo#Database.Drop>`__ \ No newline at end of file +- `Drop() <{+api+}/mongo#Database.Drop>`__ diff --git a/source/includes/language-compatibility-table-go.rst b/source/includes/language-compatibility-table-go.rst index 9c241472..370f7627 100644 --- a/source/includes/language-compatibility-table-go.rst +++ b/source/includes/language-compatibility-table-go.rst @@ -1 +1 @@ -The {+driver-long+} requires Go 1.18 or later. \ No newline at end of file +The {+driver-long+} requires Go {+min-lang-version+} or later. \ No newline at end of file diff --git a/source/includes/mongodb-compatibility-table-go.rst b/source/includes/mongodb-compatibility-table-go.rst index 3b8a223f..a4c9ec20 100644 --- a/source/includes/mongodb-compatibility-table-go.rst +++ b/source/includes/mongodb-compatibility-table-go.rst @@ -8,54 +8,29 @@ - MongoDB 7.0 - MongoDB 6.1 - MongoDB 6.0 - - MongoDB 5.0 - - MongoDB 4.4 - - MongoDB 4.2 - - MongoDB 4.0 - - MongoDB 3.6 * - 2.2 - ✓ - ✓ - ✓ - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✗ * - 2.1 - ✓ - ✓ - ✓ - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ * - 1.12 to 2.0 - ⊛ [#8.0-support]_ - ✓ - ✓ - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ * - 1.11 - ⊛ - ⊛ - ✓ - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ .. [#8.0-support] {+driver-short+} v1.17 and v2.0 are partially compatible with {+mdb-server+} 8.0 but do not support client bulk write. diff --git a/source/includes/quick-start/atlas-setup.rst b/source/includes/quick-start/atlas-setup.rst index d9ee6259..35cae229 100644 --- a/source/includes/quick-start/atlas-setup.rst +++ b/source/includes/quick-start/atlas-setup.rst @@ -43,26 +43,14 @@ when applicable, and connection options. .. step:: Retrieve your MongoDB Atlas connection string To retrieve your connection string for the cluster you created in the - previous section, log in to your Atlas account. Navigate to the - :guilabel:`Database` section and click :guilabel:`Clusters`. Click the - :guilabel:`Connect` button for the cluster that you want to connect to as - shown below: - - .. figure:: /includes/figures/atlas_connection_select_cluster.png - :alt: Atlas Connection GUI cluster selection screen - - Then, select the :guilabel:`Drivers` option under the :guilabel:`Connect - to your application` header. Select "Go" from the :guilabel:`Driver` - selection menu and the version that best matches the version you installed - from the :guilabel:`Version` selection menu. - - .. step:: Copy your connection string - - Click the button to 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_go.png - :alt: Atlas Connection GUI connection string screen + previous section, do the following: + + 1. Log in to your Atlas account. + 2. Navigate to the :guilabel:`Database` section on the sidebar and select :guilabel:`Clusters`. + 3. Find the cluster you would like to connect to and click the :guilabel:`Connect` button. + 4. Under :guilable:`Connect to your application`, click the :guilabel:`Drivers` option. + 5. Select "Go" from the :guilabel:`Driver` selection menu and the appropriate version from the :guilabel:`Version` selection menu. + 6. Copy the connection string clipboard. .. step:: Update the placeholders @@ -75,6 +63,5 @@ when applicable, and connection options. After completing these steps, you have a connection string that corresponds your Atlas cluster. -To learn more about connecting to the {+driver-long+} through Atlas, see -the :atlas:`Atlas driver connection guide ` -and select **Go** from the :guilabel:`Select your language` dropdown. +To learn more about connecting to Atlas by using the {+driver-long+} and applying +connection options, see the :atlas:`Atlas driver connection guide `. diff --git a/source/includes/usage-examples/code-snippets/updateMany.go b/source/includes/usage-examples/code-snippets/updateMany.go index 2731812e..846297c5 100644 --- a/source/includes/usage-examples/code-snippets/updateMany.go +++ b/source/includes/usage-examples/code-snippets/updateMany.go @@ -56,6 +56,7 @@ func main() { // Prints the number of updated documents fmt.Printf("Documents updated: %v\n", result.ModifiedCount) + // end updatemany // When you run this file for the first time, it should print output similar to the following: // Documents updated: 296 diff --git a/source/indexes.txt b/source/indexes.txt index 92768652..66dcf26d 100644 --- a/source/indexes.txt +++ b/source/indexes.txt @@ -86,8 +86,8 @@ results directly from the index, also called a **covered query**. - ``name`` ascending, ``age`` descending - ``name`` descending, ``age`` ascending - Specifying a sort order of ``name`` and :guilabel:`age` ascending or :guilabel:`name` and ``age`` - descending requires an in-memory sort. + However, specifying a sort order of both fields in the same + direction requires an in-memory sort. To learn how to ensure your index covers your query criteria and projection, see :manual:`Query Coverage diff --git a/source/monitoring-and-logging/change-streams.txt b/source/monitoring-and-logging/change-streams.txt index d72add1f..60c8d08f 100644 --- a/source/monitoring-and-logging/change-streams.txt +++ b/source/monitoring-and-logging/change-streams.txt @@ -295,4 +295,4 @@ documentation: - `Watch() for collections <{+api+}/mongo#Collection.Watch>`__ - `Watch() for databases <{+api+}/mongo#Database.Watch>`__ -- `Watch() for clients <{+api+}/mongo#Client.Watch>`__ \ No newline at end of file +- `Watch() for clients <{+api+}/mongo#Client.Watch>`__ diff --git a/source/quick-reference.txt b/source/quick-reference.txt index 93a7cc37..3e98c2ed 100644 --- a/source/quick-reference.txt +++ b/source/quick-reference.txt @@ -7,8 +7,6 @@ Quick Reference .. meta:: :description: Explore with the MongoDB Go Driver syntax for various commands, including find, insert, update, delete, and more, with links to API documentation and usage examples. -.. default-domain:: mongodb - This page shows the driver syntax for several MongoDB commands and links to their related reference and API documentation. diff --git a/source/reference/release-notes.txt b/source/reference/release-notes.txt index 92f5ad6e..ea8162b7 100644 --- a/source/reference/release-notes.txt +++ b/source/reference/release-notes.txt @@ -83,23 +83,23 @@ What's New in 2.1 The 2.1 {+driver-short+} release includes the following improvements and fixes: -- Introduces the new `Client.BulkWrite <{+api+}/mongo#Client.BulkWrite>`__ method, +- Introduces the `Client.BulkWrite <{+api+}/mongo#Client.BulkWrite>`__ method, enabling clients to perform multiple insert, update, and delete operations across multiple databases and collections in a single request. To learn more, see the :ref:`golang-bulk` guide. -- Introduces the new `bson.Vector <{+api+}/bson#Vector>`__ type to make inserting and querying +- Introduces the `bson.Vector <{+api+}/bson#Vector>`__ type to make inserting and querying vector data by using :atlas:`Atlas Vector Search ` - easier and more efficient. For an example using the ``bson.Vector`` type, see - the {+driver-short+}'s :ref:`Atlas Vector Search ` guide. + easier and more efficient. To view an example that uses the ``bson.Vector`` type, see + the :ref:`Atlas Vector Search ` guide. - Extends the `ServerError <{+api+}/mongo#ServerError>`__ interface to include ``ErrorCodes``, which returns a list of deduplicated error codes returned by the server during the lifetime of operation execution. - Adds the ``sort`` option to `UpdateOneOptions <{+api+}/mongo/options#UpdateOneOptions>`__ - and `ReplaceOptions <{+api+}/mongo/options#ReplaceOptions>`__ for the ``updateOne`` - and ``replaceOne`` operations. + and `ReplaceOptions <{+api+}/mongo/options#ReplaceOptions>`__ for + standalone update and replace operations and in bulk operations. For more information about the changes in this version, see the :github:`v2.1 release notes ` diff --git a/source/reference/upgrade.txt b/source/reference/upgrade.txt index 5f1d27e7..2b39137f 100644 --- a/source/reference/upgrade.txt +++ b/source/reference/upgrade.txt @@ -103,4 +103,4 @@ Version 2.0 Breaking Changes - Removal of the ``bson/primitive`` package. This package is now merged with the ``bson`` package. To update your code, remove any ``bson/primitive`` import statements and change any instance of ``primitive.ObjectID`` to - ``bson.ObjectId``. \ No newline at end of file + ``bson.ObjectId``.