diff --git a/source/connection-troubleshooting.txt b/source/connection-troubleshooting.txt index c3d8c49f2..ff913b0f4 100644 --- a/source/connection-troubleshooting.txt +++ b/source/connection-troubleshooting.txt @@ -88,7 +88,7 @@ Connection Troubleshooting .. code-block:: java :copyable: false - String uri = "mongodb://:@:/?authSource=users&authMechanism=SCRAM-SHA-256"; + String uri = "mongodb://:@:/?authSource=users&authMechanism=SCRAM-SHA-256"; MongoClient mongoClient = MongoClients.create(uri); .. replacement:: credentials-provider-alternative-method-description @@ -100,7 +100,7 @@ Connection Troubleshooting .. code-block:: java :copyable: false - MongoCredential credential = MongoCredential.createScramSha256Credential("", "", ""); + MongoCredential credential = MongoCredential.createScramSha256Credential("", "", ""); .. replacement:: authentication-guide-reference @@ -117,7 +117,7 @@ Connection Troubleshooting .. code-block:: java :copyable: false - MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=users"); + MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=users"); .. replacement:: dns-resolution-anchor diff --git a/source/fundamentals/auth.txt b/source/fundamentals/auth.txt index 59e2706a9..0d8630ef4 100644 --- a/source/fundamentals/auth.txt +++ b/source/fundamentals/auth.txt @@ -95,7 +95,7 @@ mechanism: .. code-block:: java - MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource="); + MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource="); .. tab:: :tabid: MongoCredential @@ -157,7 +157,7 @@ mechanism: .. code-block:: java - MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=&authMechanism=SCRAM-SHA-256"); + MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=&authMechanism=SCRAM-SHA-256"); .. tab:: :tabid: MongoCredential @@ -215,7 +215,7 @@ mechanism: .. code-block:: java - MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=&authMechanism=SCRAM-SHA-1"); + MongoClient mongoClient = MongoClients.create("mongodb://:@:/?authSource=&authMechanism=SCRAM-SHA-1"); .. tab:: :tabid: MongoCredential diff --git a/source/fundamentals/connection/mongoclientsettings.txt b/source/fundamentals/connection/mongoclientsettings.txt index 7bf5fcaf4..4f1ade7ee 100644 --- a/source/fundamentals/connection/mongoclientsettings.txt +++ b/source/fundamentals/connection/mongoclientsettings.txt @@ -187,7 +187,7 @@ This example demonstrates specifying a ``ConnectionString``: :emphasize-lines: 2,4 MongoClient mongoClient = MongoClients.create( - MongoClientSettings.builder().applyConnectionString(new ConnectionString("mongodb+srv://:@:/?connectTimeoutMS=2000")) + MongoClientSettings.builder().applyConnectionString(new ConnectionString("mongodb+srv://:@:/?connectTimeoutMS=2000")) .applyToSocketSettings(builder -> builder.connectTimeout(5L, SECONDS)) .build()); diff --git a/source/fundamentals/connection/network-compression.txt b/source/fundamentals/connection/network-compression.txt index ef319ff22..76390f1e5 100644 --- a/source/fundamentals/connection/network-compression.txt +++ b/source/fundamentals/connection/network-compression.txt @@ -53,7 +53,7 @@ connection string using ``ConnectionString`` or by calling the method in the .. code-block:: java - ConnectionString connectionString = new ConnectionString("mongodb+srv://:@/?compressors=snappy,zlib,zstd"); + ConnectionString connectionString = new ConnectionString("mongodb+srv://:@/?compressors=snappy,zlib,zstd"); MongoClient mongoClient = MongoClients.create(connectionString); Specify compression algorithms using the following strings: diff --git a/source/fundamentals/connection/tls.txt b/source/fundamentals/connection/tls.txt index d826373c2..a84d4ddec 100644 --- a/source/fundamentals/connection/tls.txt +++ b/source/fundamentals/connection/tls.txt @@ -67,7 +67,7 @@ using a method in the ``MongoClientSettings.Builder`` class. .. code-block:: java - MongoClient mongoClient = MongoClients.create("mongodb+srv://:@?tls=true"); + MongoClient mongoClient = MongoClients.create("mongodb+srv://:@?tls=true"); .. tab:: MongoClientSettings :tabid: mongoclientsettings diff --git a/source/fundamentals/enterprise-auth.txt b/source/fundamentals/enterprise-auth.txt index 24041bfd3..f6c15eda0 100644 --- a/source/fundamentals/enterprise-auth.txt +++ b/source/fundamentals/enterprise-auth.txt @@ -92,7 +92,7 @@ mechanism: .. code-block:: java - MongoClient mongoClient = MongoClients.create("@:/?authSource=$external&authMechanism=GSSAPI"); + MongoClient mongoClient = MongoClients.create("@:/?authSource=$external&authMechanism=GSSAPI"); .. tab:: :tabid: MongoCredential @@ -151,7 +151,7 @@ You might need to specify one or more of the following additional .. code-block:: java - MongoClient mongoClient = MongoClients.create("@:/?authSource=$external&authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:myService"); + MongoClient mongoClient = MongoClients.create("@:/?authSource=$external&authMechanism=GSSAPI&authMechanismProperties=SERVICE_NAME:myService"); .. tab:: :tabid: MongoCredential @@ -277,7 +277,7 @@ mechanism: .. code-block:: java - MongoClient mongoClient = MongoClients.create(":@:/?authSource=$external&authMechanism=PLAIN"); + MongoClient mongoClient = MongoClients.create(":@:/?authSource=$external&authMechanism=PLAIN"); .. tab:: :tabid: MongoCredential @@ -340,21 +340,21 @@ see the corresponding syntax. .. code-block:: java MongoClient mongoClient = MongoClients.create( - "mongodb://@:/?" + + "mongodb://@:/?" + "?authMechanism=MONGODB-OIDC" + "&authMechanismProperties=ENVIRONMENT:azure,TOKEN_RESOURCE:"); .. tab:: MongoCredential :tabid: mongodb-azure-mongo-credential - Replace the ```` placeholder with the client ID or application ID of the + Replace the ```` placeholder with the client ID or application ID of the Azure managed identity or enterprise application. Replace the ```` placeholder with the value of the ``audience`` server parameter configured on your MongoDB deployment. .. code-block:: java - MongoCredential credential = MongoCredential.createOidcCredential("") + MongoCredential credential = MongoCredential.createOidcCredential("") .withMechanismProperty("ENVIRONMENT", "azure") .withMechanismProperty("TOKEN_RESOURCE", ""); diff --git a/source/fundamentals/indexes.txt b/source/fundamentals/indexes.txt index f05be7497..bce5ff2e5 100644 --- a/source/fundamentals/indexes.txt +++ b/source/fundamentals/indexes.txt @@ -595,4 +595,4 @@ For prior versions of MongoDB, pass "*" as a parameter to your call to For more information about the methods in this section, see the following API Documentation: - `dropIndex() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndex(java.lang.String)>`__ -- `dropIndexes() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndexes()>`__ +- `dropIndexes() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCollection.html#dropIndexes()>`__ \ No newline at end of file diff --git a/source/includes/faq/code-snippets/FaqExample.java b/source/includes/faq/code-snippets/FaqExample.java index 7bc730d7a..ba355e8bc 100644 --- a/source/includes/faq/code-snippets/FaqExample.java +++ b/source/includes/faq/code-snippets/FaqExample.java @@ -34,7 +34,7 @@ public static void main(String[] args) { fromProviders(pojoCodecProvider)); // end myDateAsStringCodec - String uri = "mongodb+srv://:@?retryWrites=true&w=majority"; + String uri = "mongodb+srv://:@?retryWrites=true&w=majority"; try (MongoClient mongoClient = MongoClients.create(uri)) { diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-default.rst b/source/includes/fundamentals/code-snippets/auth-credentials-default.rst index c60212ccd..391bd9153 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-default.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-default.rst @@ -1,6 +1,6 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createCredential("", "", ""); + MongoCredential credential = MongoCredential.createCredential("", "", ""); MongoClient mongoClient = MongoClients.create( MongoClientSettings.builder() diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-properties.rst b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-properties.rst index 44be88a73..f4ec395ce 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-properties.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-properties.rst @@ -1,5 +1,5 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createGSSAPICredential(); + MongoCredential credential = MongoCredential.createGSSAPICredential(); credential = credential.withMechanismProperty(MongoCredential.SERVICE_NAME_KEY, "myService"); diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-subject-key.rst b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-subject-key.rst index 69af1abc0..a5c1da73c 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-subject-key.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-subject-key.rst @@ -4,6 +4,6 @@ loginContext.login(); Subject subject = loginContext.getSubject(); - MongoCredential credential = MongoCredential.createGSSAPICredential(); + MongoCredential credential = MongoCredential.createGSSAPICredential(); credential = credential.withMechanismProperty(MongoCredential.JAVA_SUBJECT_KEY, subject); diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-ticket-cache.rst b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-ticket-cache.rst index 2994dee8b..b446e3987 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-ticket-cache.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi-ticket-cache.rst @@ -3,7 +3,7 @@ /* all MongoClient instances sharing this instance of KerberosSubjectProvider will share a Kerberos ticket cache */ String myLoginContext = "myContext"; - MongoCredential credential = MongoCredential.createGSSAPICredential(); + MongoCredential credential = MongoCredential.createGSSAPICredential(); /* login context defaults to "com.sun.security.jgss.krb5.initiate" if unspecified in KerberosSubjectProvider */ credential = credential.withMechanismProperty(MongoCredential.JAVA_SUBJECT_PROVIDER_KEY, diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi.rst b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi.rst index 9a78d0853..5f76050a4 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-gssapi.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-gssapi.rst @@ -1,6 +1,6 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createGSSAPICredential(); + MongoCredential credential = MongoCredential.createGSSAPICredential(); MongoClient mongoClient = MongoClients.create( MongoClientSettings.builder() diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-ldap.rst b/source/includes/fundamentals/code-snippets/auth-credentials-ldap.rst index 305e3201c..d539843dc 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-ldap.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-ldap.rst @@ -1,6 +1,6 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createPlainCredential(, "$external", ); + MongoCredential credential = MongoCredential.createPlainCredential(, "$external", ); MongoClient mongoClient = MongoClients.create( MongoClientSettings.builder() diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-sha1.rst b/source/includes/fundamentals/code-snippets/auth-credentials-sha1.rst index 29644d77c..c2f382a93 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-sha1.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-sha1.rst @@ -1,6 +1,6 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createScramSha1Credential("", "", ""); + MongoCredential credential = MongoCredential.createScramSha1Credential("", "", ""); MongoClient mongoClient = MongoClients.create( MongoClientSettings.builder() diff --git a/source/includes/fundamentals/code-snippets/auth-credentials-sha256.rst b/source/includes/fundamentals/code-snippets/auth-credentials-sha256.rst index 2d16a3aa5..02af4fddb 100644 --- a/source/includes/fundamentals/code-snippets/auth-credentials-sha256.rst +++ b/source/includes/fundamentals/code-snippets/auth-credentials-sha256.rst @@ -1,6 +1,6 @@ .. code-block:: java - MongoCredential credential = MongoCredential.createScramSha256Credential("", "", ""); + MongoCredential credential = MongoCredential.createScramSha256Credential("", "", ""); MongoClient mongoClient = MongoClients.create( MongoClientSettings.builder() diff --git a/source/includes/quick-reference/QuickReferenceSnippets.java b/source/includes/quick-reference/QuickReferenceSnippets.java index d58dad57a..90a0c0a98 100644 --- a/source/includes/quick-reference/QuickReferenceSnippets.java +++ b/source/includes/quick-reference/QuickReferenceSnippets.java @@ -171,7 +171,7 @@ private static void searchTextExample(MongoCollection coll) { public static void main(String[] args) { // Replace the uri string with your MongoDB deployment's connection string - String uri = "mongodb+srv://:@?retryWrites=true&w=majority"; + String uri = "mongodb+srv://:@?retryWrites=true&w=majority"; try (MongoClient mongoClient = MongoClients.create(uri)) { MongoDatabase database = mongoClient.getDatabase("movies"); diff --git a/source/quick-start.txt b/source/quick-start.txt index d63082b69..4cac68ca4 100644 --- a/source/quick-start.txt +++ b/source/quick-start.txt @@ -113,7 +113,7 @@ Create a new file ``QuickStartPojoExample.java`` in the same package directory as your ``Movie`` file in your project. Use the following sample code to run a query on your sample dataset in MongoDB Atlas, replacing the value of the ``uri`` variable with your MongoDB Atlas connection string. -Ensure you replace the "" section of the connection string with +Ensure you replace the "" section of the connection string with the password you created for your user that has **atlasAdmin** permissions: .. literalinclude:: /includes/quick-start/code-snippets/QuickStartPojoExample.java diff --git a/source/usage-examples.txt b/source/usage-examples.txt index c24426c69..307fdbf53 100644 --- a/source/usage-examples.txt +++ b/source/usage-examples.txt @@ -66,7 +66,7 @@ to learn how to allow connections to your instance of Atlas and to find the :manual:`connection string ` you use to replace the ``uri`` variable in usage examples. If your instance uses :manual:`SCRAM authentication `, you can replace -```` with your username, ```` with your password, and +```` with your database username, ```` with your database password, and ```` with the IP address or URL of your instance. For more information about connecting to your MongoDB instance, see our