From d81df88d446874b1fd1f017f71c57d9c984fb0eb Mon Sep 17 00:00:00 2001 From: rustagir Date: Tue, 30 Apr 2024 13:42:51 -0400 Subject: [PATCH] DOCSP-38202: scala link updates --- config/redirects | 4 + .../scram/scala-connection-no-stableapi.scala | 25 -- .../scram/scala-connection.scala | 35 -- .../x509-snippets/scala-connection.scala | 31 -- source/includes/help-links-scala.rst | 6 - .../language-compatibility-table-scala.rst | 106 ------ .../mongodb-compatibility-table-scala.rst | 345 ------------------ .../stable-api-snippets/scala-client.scala | 14 - source/index.txt | 4 +- source/scala.txt | 116 ------ 10 files changed, 6 insertions(+), 680 deletions(-) delete mode 100644 source/includes/connection-snippets/scram/scala-connection-no-stableapi.scala delete mode 100644 source/includes/connection-snippets/scram/scala-connection.scala delete mode 100644 source/includes/connection-snippets/x509-snippets/scala-connection.scala delete mode 100644 source/includes/help-links-scala.rst delete mode 100644 source/includes/language-compatibility-table-scala.rst delete mode 100644 source/includes/mongodb-compatibility-table-scala.rst delete mode 100644 source/includes/stable-api-snippets/scala-client.scala delete mode 100644 source/scala.txt diff --git a/config/redirects b/config/redirects index 2c1b5c50b..3f8394746 100644 --- a/config/redirects +++ b/config/redirects @@ -16,6 +16,10 @@ raw: docs/drivers/go -> https://www.mongodb.com/docs/drivers/go/current/ raw: docs/drivers/java -> ${base}/java-drivers/ raw: docs/drivers/reactive-streams/ -> https://www.mongodb.com/docs/languages/java/reactive-streams-driver/current/ +# Scala + +raw: docs/drivers/scala/ -> https://www.mongodb.com/docs/languages/scala/scala-driver/current/ + # Rust raw: docs/drivers/rust -> https://www.mongodb.com/docs/drivers/rust/current/ diff --git a/source/includes/connection-snippets/scram/scala-connection-no-stableapi.scala b/source/includes/connection-snippets/scram/scala-connection-no-stableapi.scala deleted file mode 100644 index 573c29238..000000000 --- a/source/includes/connection-snippets/scram/scala-connection-no-stableapi.scala +++ /dev/null @@ -1,25 +0,0 @@ -import org.mongodb.scala.MongoClient -import org.mongodb.scala.bson.Document - -import scala.concurrent.Await -import scala.concurrent.duration.DurationInt -import scala.util.Using - -object MongoClientConnectionExample { - - def main(args: Array[String]): Unit = { - - // Replace the placeholder with your Atlas connection string - val connectionString = ""; - - // Create a new client and connect to the server - Using(MongoClient(connectionString)) { mongoClient => - // Send a ping to confirm a successful connection - val database = mongoClient.getDatabase("admin") - val ping = database.runCommand(Document("ping" -> 1)).head() - - Await.result(ping, 10.seconds) - System.out.println("Pinged your deployment. You successfully connected to MongoDB!") - } - } -} \ No newline at end of file diff --git a/source/includes/connection-snippets/scram/scala-connection.scala b/source/includes/connection-snippets/scram/scala-connection.scala deleted file mode 100644 index 8db975c3a..000000000 --- a/source/includes/connection-snippets/scram/scala-connection.scala +++ /dev/null @@ -1,35 +0,0 @@ -import com.mongodb.{ServerApi, ServerApiVersion} -import org.mongodb.scala.{ConnectionString, MongoClient, MongoClientSettings} -import org.mongodb.scala.bson.Document - -import scala.concurrent.Await -import scala.concurrent.duration.DurationInt -import scala.util.Using - -object MongoClientConnectionExample { - - def main(args: Array[String]): Unit = { - - // Replace the placeholder with your Atlas connection string - val connectionString = ""; - - // Construct a ServerApi instance using the ServerApi.builder() method - val serverApi = ServerApi.builder.version(ServerApiVersion.V1).build() - - val settings = MongoClientSettings - .builder() - .applyConnectionString(ConnectionString(connectionString)) - .serverApi(serverApi) - .build() - - // Create a new client and connect to the server - Using(MongoClient(settings)) { mongoClient => - // Send a ping to confirm a successful connection - val database = mongoClient.getDatabase("admin") - val ping = database.runCommand(Document("ping" -> 1)).head() - - Await.result(ping, 10.seconds) - System.out.println("Pinged your deployment. You successfully connected to MongoDB!") - } - } -} \ No newline at end of file diff --git a/source/includes/connection-snippets/x509-snippets/scala-connection.scala b/source/includes/connection-snippets/x509-snippets/scala-connection.scala deleted file mode 100644 index 89e36ed7b..000000000 --- a/source/includes/connection-snippets/x509-snippets/scala-connection.scala +++ /dev/null @@ -1,31 +0,0 @@ -// begin x509 connection -import scala.collection.JavaConverters._ -import org.mongodb.scala._ -import org.mongodb.scala.bson.collection.mutable.Document -import org.mongodb.scala.connection.{ClusterSettings, SslSettings} - -object MongoDBx509 extends App { - - System.setProperty("javax.net.ssl.keyStore", "client.keystore") - System.setProperty("javax.net.ssl.keyStorePassword", "") - - val credential = MongoCredential.createMongoX509Credential() - - val settings = MongoClientSettings.builder() - .credential(credential) - .applyToClusterSettings( - (builder: ClusterSettings.Builder) - => builder.hosts(List(new ServerAddress("")).asJava)) - .applyToSslSettings( - (builder : SslSettings.Builder) - => builder.enabled(true)) - .build() - - val client : MongoClient = MongoClient(settings) - val database: MongoDatabase = client.getDatabase("testDB") - val collection: MongoCollection[Document] = database.getCollection("testCol") - - val docCount = collection.countDocuments() - println(docCount) -} -// end x509 connection diff --git a/source/includes/help-links-scala.rst b/source/includes/help-links-scala.rst deleted file mode 100644 index 5a143644c..000000000 --- a/source/includes/help-links-scala.rst +++ /dev/null @@ -1,6 +0,0 @@ -How to get help ---------------- - -- Ask questions on our :community-forum:`MongoDB Community Forums <>`. -- Visit our :technical-support:`Support Channels `. -- See `Issues & Help <{+java-api+}/issues-help/>`__. diff --git a/source/includes/language-compatibility-table-scala.rst b/source/includes/language-compatibility-table-scala.rst deleted file mode 100644 index 4560135ae..000000000 --- a/source/includes/language-compatibility-table-scala.rst +++ /dev/null @@ -1,106 +0,0 @@ - -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - :class: compatibility - - * - Scala Driver Version - - Scala 2.13 - - Scala 2.12 - - Scala 2.11 - * - 4.11 - - ✓ - - ✓ - - ✓ - * - 4.10 - - ✓ - - ✓ - - ✓ - * - 4.9 - - ✓ - - ✓ - - ✓ - * - 4.8 - - ✓ - - ✓ - - ✓ - * - 4.7 - - ✓ - - ✓ - - ✓ - * - 4.6 - - ✓ - - ✓ - - ✓ - * - 4.5 - - ✓ - - ✓ - - ✓ - * - 4.4 - - ✓ - - ✓ - - ✓ - * - 4.3 - - ✓ - - ✓ - - ✓ - * - 4.2 - - ✓ - - ✓ - - ✓ - * - 4.1 - - ✓ - - ✓ - - ✓ - * - 2.9 - - ✓ - - ✓ - - ✓ - * - 2.8 - - ✓ - - ✓ - - ✓ - * - 2.7 - - ✓ - - ✓ - - ✓ - * - 2.6 - - - - ✓ - - ✓ - * - 2.5 - - - - ✓ - - ✓ - * - 2.4 - - - - ✓ - - ✓ - * - 2.3 - - - - ✓ - - ✓ - * - 2.2 - - - - ✓ - - ✓ - * - 2.1 - - - - ✓ - - ✓ - * - 2.0 - - - - ✓ - - ✓ - * - 1.2 - - - - ✓ - - ✓ - * - 1.1 - - - - - - ✓ - * - 1.0 - - - - - - ✓ diff --git a/source/includes/mongodb-compatibility-table-scala.rst b/source/includes/mongodb-compatibility-table-scala.rst deleted file mode 100644 index 084340608..000000000 --- a/source/includes/mongodb-compatibility-table-scala.rst +++ /dev/null @@ -1,345 +0,0 @@ -.. sharedinclude:: dbx/compatibility-table-legend.rst - -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - :class: compatibility-large - - * - Scala Driver Version - - MongoDB 7.0 - - MongoDB 6.1 - - MongoDB 6.0 - - MongoDB 5.0 - - MongoDB 4.4 - - MongoDB 4.2 - - MongoDB 4.0 - - MongoDB 3.6 - - MongoDB 3.4 - - MongoDB 3.2 - - MongoDB 3.0 - - MongoDB 2.6 - * - 4.11 - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - * - 4.10 - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - * - 4.9 - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - * - 4.8 - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - * - 4.7 - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.6 - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.5 - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.4 - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.3 - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.2 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.1 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 4.0 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.9 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.8 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.7 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.6 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.5 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.4 - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.3 - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.2 - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.1 - - - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.0 - - - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - 1.2 - - - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - - ✓ - * - 1.1 - - - - - - - - - - - - - - - - - - - - ✓ - - ✓ - - ✓ - * - 1.0 - - - - - - - - - - - - - - - - - - - - - - ✓ - - ✓ diff --git a/source/includes/stable-api-snippets/scala-client.scala b/source/includes/stable-api-snippets/scala-client.scala deleted file mode 100644 index e416c81e4..000000000 --- a/source/includes/stable-api-snippets/scala-client.scala +++ /dev/null @@ -1,14 +0,0 @@ -import com.mongodb.{ServerApi, ServerApiVersion} -import org.mongodb.scala._ - -// ... - -// Replace with your MongoDB deployment's connection string. -val uri = "" - -// Set the Stable API version on the client. -val mongoClientSettings = MongoClientSettings.builder().applyConnectionString(ConnectionString(uri)) - .serverApi(ServerApi.builder().version(ServerApiVersion.V1).build()) - .build() - -val mongoClient = MongoClient(mongoClientSettings) diff --git a/source/index.txt b/source/index.txt index 682a7852c..080848040 100644 --- a/source/index.txt +++ b/source/index.txt @@ -92,7 +92,7 @@ security patches to them. .. card:: :headline: Scala - :url: /scala/ + :url: https://www.mongodb.com/docs/languages/scala/scala-driver/current/ :icon: /icons/scala.svg :icon-alt: Scala Driver icon @@ -165,7 +165,7 @@ with MongoDB: Python Drivers Ruby Drivers Rust Driver - Scala Driver + Scala Driver Swift Driver TypeScript About Compatibility Tables diff --git a/source/scala.txt b/source/scala.txt deleted file mode 100644 index be8cd6a44..000000000 --- a/source/scala.txt +++ /dev/null @@ -1,116 +0,0 @@ -.. _scala: - -==================== -MongoDB Scala Driver -==================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: twocols - -Introduction ------------- - -Welcome to the documentation site for the official MongoDB Scala -driver. You can add the driver to your application to work -asynchronously with MongoDB in Scala. Download it using -`sbt `__ or -`Apache Maven `__, or set up a runnable -project by following our tutorials. - -- `Reference Documentation <{+java-api+}/driver-scala/>`__ - -- `Tutorials <{+java-api+}/driver-scala/tutorials/>`__ - -- `API Documentation <{+java-api+}/apidocs/>`__ - -- `What's New <{+java-api+}/whats-new/>`__ - -- `Source Code `__ - - -Installation ------------- - -The recommended way to get started using the driver in your project is -with a dependency management system like ``sbt`` or ``maven``. See the -`Installation Guide <{+java-api+}/driver-scala/getting-started/installation/>`__ -for more information. - -.. _connect-atlas-scala-driver: - -Connect to MongoDB Atlas ------------------------- - -You can use the following connection snippet to test your connection to -your MongoDB deployment on Atlas: - -.. literalinclude:: /includes/connection-snippets/scram/scala-connection.scala - :language: scala - -This connection snippet uses the {+stable-api+} feature, which you can -enable when using the Scala driver v4.3 and later to connect to MongoDB Server -v5.0 and later. When you use this feature, you can update your driver or server without -worrying about backward compatibility issues with any commands covered by the -{+stable-api+}. - -To learn more about the {+stable-api+} feature, see -:manual:`{+stable-api+} ` in the Server manual. - -.. include:: /includes/stable-api-notice.rst - -.. _connect-atlas-no-stable-api-scala-driver: - -Connect to MongoDB Atlas Without the Stable API ------------------------------------------------ - -If you are using a version of MongoDB or the driver that doesn't support the -{+stable-api+} feature, you can use the following code snippet to test your connection -to your MongoDB deployment on Atlas: - -.. literalinclude:: /includes/connection-snippets/scram/scala-connection-no-stableapi.scala - :language: scala - -Connect to a MongoDB Server on Your Local Machine -------------------------------------------------- - -.. include:: /includes/localhost-connection.rst - -To test whether you can connect to your server, replace the connection -string in the :ref:`Connect to MongoDB Atlas ` code -example and run it. - -Compatibility -------------- - -MongoDB Compatibility -~~~~~~~~~~~~~~~~~~~~~ - -The following compatibility table specifies the recommended version or versions -of the Mongo Scala driver for use with a specific version of MongoDB. - -The first column lists the driver version. - -.. sharedinclude:: dbx/lifecycle-schedule-callout.rst - -.. include:: /includes/mongodb-compatibility-table-scala.rst - -.. include:: /includes/older-server-versions-unsupported.rst - -Language Compatibility -~~~~~~~~~~~~~~~~~~~~~~ - -The following compatibility table specifies the recommended version or versions -of the Mongo Scala driver for use with a specific version of Scala. - -The first column lists the driver version. - -.. include:: /includes/language-compatibility-table-scala.rst - -.. include:: /includes/about-driver-compatibility.rst - -.. include:: /includes/help-links-scala.rst