From 10bcf6d052c58fd3ff60e6df1601f867a67e3218 Mon Sep 17 00:00:00 2001 From: Rea Rustagi <85902999+rustagir@users.noreply.github.com> Date: Thu, 12 Oct 2023 17:15:23 -0400 Subject: [PATCH] DOCSP-33640: link to new rust docs (#920) * DOCSP-33640: link to new rust docs * CC suggestion --- config/redirects | 6 +- .../scram/rust-connection-async.rs | 26 ---- .../rust-connection-no-stableapi-async.rs | 22 --- .../rust-connection-no-stableapi-sync.rs | 17 -- .../scram/rust-connection-sync.rs | 23 --- source/includes/help-links-rust.rst | 7 - .../language-compatibility-table-rust.rst | 1 - .../mongodb-compatibility-table-rust.rst | 107 ------------- source/index.txt | 4 +- source/rust.txt | 146 ------------------ 10 files changed, 7 insertions(+), 352 deletions(-) delete mode 100644 source/includes/connection-snippets/scram/rust-connection-async.rs delete mode 100644 source/includes/connection-snippets/scram/rust-connection-no-stableapi-async.rs delete mode 100644 source/includes/connection-snippets/scram/rust-connection-no-stableapi-sync.rs delete mode 100644 source/includes/connection-snippets/scram/rust-connection-sync.rs delete mode 100644 source/includes/help-links-rust.rst delete mode 100644 source/includes/language-compatibility-table-rust.rst delete mode 100644 source/includes/mongodb-compatibility-table-rust.rst delete mode 100644 source/rust.txt diff --git a/config/redirects b/config/redirects index 27b3b6aa3..74a127859 100644 --- a/config/redirects +++ b/config/redirects @@ -12,6 +12,10 @@ raw: docs/drivers/go -> https://www.mongodb.com/docs/drivers/go/current/ raw: docs/drivers/java -> ${base}/java-drivers/ +# Rust + +raw: docs/drivers/rust -> https://www.mongodb.com/docs/drivers/rust/current/ + # Manual FLE merge - update URLs after 6.0 release raw: docs/drivers/security -> ${manual}/core/csfle/ @@ -212,7 +216,7 @@ raw: docs/drivers/drivers/php/ -> ${base}/php/ raw: docs/drivers/drivers/python/ -> ${base}/python/ raw: docs/drivers/drivers/pymongo/ -> ${base}/pymongo/ raw: docs/drivers/drivers/ruby/ -> https://www.mongodb.com/docs/ruby-driver/current/ -raw: docs/drivers/drivers/rust/ -> ${base}/rust/ +raw: docs/drivers/drivers/rust/ -> ${base}/rust/current/ raw: docs/drivers/drivers/scala/ -> ${base}/scala/ raw: docs/drivers/drivers/swift/ -> ${base}/swift/ diff --git a/source/includes/connection-snippets/scram/rust-connection-async.rs b/source/includes/connection-snippets/scram/rust-connection-async.rs deleted file mode 100644 index 192cfb360..000000000 --- a/source/includes/connection-snippets/scram/rust-connection-async.rs +++ /dev/null @@ -1,26 +0,0 @@ -use mongodb::{bson::doc, options::{ClientOptions, ServerApi, ServerApiVersion}, Client}; - -#[tokio::main] -async fn main() -> mongodb::error::Result<()> { - // Replace the placeholder with your Atlas connection string - let uri = ""; - let mut client_options = - ClientOptions::parse(uri) - .await?; - - // Set the server_api field of the client_options object to Stable API version 1 - let server_api = ServerApi::builder().version(ServerApiVersion::V1).build(); - client_options.server_api = Some(server_api); - - // Create a new client and connect to the server - let client = Client::with_options(client_options)?; - - // Send a ping to confirm a successful connection - client - .database("admin") - .run_command(doc! {"ping": 1}, None) - .await?; - println!("Pinged your deployment. You successfully connected to MongoDB!"); - - Ok(()) -} \ No newline at end of file diff --git a/source/includes/connection-snippets/scram/rust-connection-no-stableapi-async.rs b/source/includes/connection-snippets/scram/rust-connection-no-stableapi-async.rs deleted file mode 100644 index 0eb0ef52a..000000000 --- a/source/includes/connection-snippets/scram/rust-connection-no-stableapi-async.rs +++ /dev/null @@ -1,22 +0,0 @@ -use mongodb::{bson::doc, options::ClientOptions, Client}; - -#[tokio::main] -async fn main() -> mongodb::error::Result<()> { - // Replace the placeholder with your Atlas connection string - let uri = ""; - let mut client_options = - ClientOptions::parse(uri) - .await?; - - // Create a new client and connect to the server - let client = Client::with_options(client_options)?; - - // Send a ping to confirm a successful connection - client - .database("admin") - .run_command(doc! {"ping": 1}, None) - .await?; - println!("Pinged your deployment. You successfully connected to MongoDB!"); - - Ok(()) -} \ No newline at end of file diff --git a/source/includes/connection-snippets/scram/rust-connection-no-stableapi-sync.rs b/source/includes/connection-snippets/scram/rust-connection-no-stableapi-sync.rs deleted file mode 100644 index d06f13a73..000000000 --- a/source/includes/connection-snippets/scram/rust-connection-no-stableapi-sync.rs +++ /dev/null @@ -1,17 +0,0 @@ -use mongodb::{bson::doc, sync::Client}; - -fn main() -> mongodb::error::Result<()> { - // Replace the placeholder with your Atlas connection string - let uri = ""; - - // Create a new client and connect to the server - let client = Client::with_uri_str(uri)?; - - // Send a ping to confirm a successful connection - client - .database("admin") - .run_command(doc! {"ping": 1}, None)?; - println!("Pinged your deployment. You successfully connected to MongoDB!"); - - Ok(()) -} \ No newline at end of file diff --git a/source/includes/connection-snippets/scram/rust-connection-sync.rs b/source/includes/connection-snippets/scram/rust-connection-sync.rs deleted file mode 100644 index fc5190de8..000000000 --- a/source/includes/connection-snippets/scram/rust-connection-sync.rs +++ /dev/null @@ -1,23 +0,0 @@ -use mongodb::{bson::doc, options::{ClientOptions, ServerApi, ServerApiVersion}, sync::Client}; - -fn main() -> mongodb::error::Result<()> { - // Replace the placeholder with your Atlas connection string - let uri = ""; - let mut client_options = - ClientOptions::parse(uri)?; - - // Set the server_api field of the client_options object to Stable API version 1 - let server_api = ServerApi::builder().version(ServerApiVersion::V1).build(); - client_options.server_api = Some(server_api); - - // Create a new client and connect to the server - let client = Client::with_options(client_options)?; - - // Send a ping to confirm a successful connection - client - .database("admin") - .run_command(doc! {"ping": 1}, None)?; - println!("Pinged your deployment. You successfully connected to MongoDB!"); - - Ok(()) -} \ No newline at end of file diff --git a/source/includes/help-links-rust.rst b/source/includes/help-links-rust.rst deleted file mode 100644 index 40341994b..000000000 --- a/source/includes/help-links-rust.rst +++ /dev/null @@ -1,7 +0,0 @@ -How to get help ---------------- - -- Ask questions on our :community-forum:`MongoDB Community Forums <>`. -- Visit our :technical-support:`Support Channels `. -- See our :issue:`RUST ` JIRA project to raise issues or request - features. diff --git a/source/includes/language-compatibility-table-rust.rst b/source/includes/language-compatibility-table-rust.rst deleted file mode 100644 index d4901183d..000000000 --- a/source/includes/language-compatibility-table-rust.rst +++ /dev/null @@ -1 +0,0 @@ -The MongoDB Rust driver requires Rust 1.60 or later. diff --git a/source/includes/mongodb-compatibility-table-rust.rst b/source/includes/mongodb-compatibility-table-rust.rst deleted file mode 100644 index 5e4815357..000000000 --- a/source/includes/mongodb-compatibility-table-rust.rst +++ /dev/null @@ -1,107 +0,0 @@ -.. sharedinclude:: dbx/compatibility-table-legend.rst - -.. list-table:: - :header-rows: 1 - :stub-columns: 1 - :class: compatibility-large - - * - Rust Driver Version - - MongoDB 7.0 - - MongoDB 6.0 - - MongoDB 5.0 - - MongoDB 4.4 - - MongoDB 4.2 - - MongoDB 4.0 - - MongoDB 3.6 - * - 2.7 [#2.5-2.7-limitation]_ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.6 [#2.5-2.7-limitation]_ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.5 [#2.5-2.7-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.4 [#2.4-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.3 [#2.2-2.3-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.2 [#2.2-2.3-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.1 [#2.1-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - * - 2.0 [#2.0-limitation]_ - - ⊛ - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - -The Rust driver is not compatible with MongoDB Server versions -older than 3.6. - -.. [#2.5-2.7-limitation] This Rust driver version does not support - :manual:`OCSP `. - -.. [#2.4-limitation] This Rust driver version does not support Decimal128 - or :manual:`OCSP `. - -.. [#2.2-2.3-limitation] This Rust driver version does not support Decimal128, - :ref:`Client-Side Field Level Encryption `, - :manual:`GridFS `, or - :manual:`OCSP `. - -.. [#2.1-limitation] This Rust driver version does not support Decimal128, - :ref:`Client-Side Field Level Encryption `, - :manual:`GridFS `, - :manual:`OCSP `, - or :ref:`change streams `. - -.. [#2.0-limitation] This Rust driver version does not support Decimal128, - :ref:`Client-Side Field Level Encryption `, - :manual:`GridFS `, - :manual:`OCSP `, - :ref:`change streams `, - :manual:`Causal Consistency `, or - :atlas:`Serverless Instances `. \ No newline at end of file diff --git a/source/index.txt b/source/index.txt index 0c854804b..c62e70dd0 100644 --- a/source/index.txt +++ b/source/index.txt @@ -85,7 +85,7 @@ security patches to them. .. card:: :headline: Rust - :url: /rust/ + :url: https://www.mongodb.com/docs/drivers/rust/current/ :icon: /icons/rust.svg :icon-alt: Rust Driver icon @@ -155,7 +155,7 @@ Don’t see your desired language? Browse more `community-supported libraries Python Drivers Ruby Drivers - Rust Driver + Rust Driver Scala Driver Swift Driver TypeScript diff --git a/source/rust.txt b/source/rust.txt deleted file mode 100644 index 21fc0acef..000000000 --- a/source/rust.txt +++ /dev/null @@ -1,146 +0,0 @@ -.. _rust-language-center: - -=================== -MongoDB Rust Driver -=================== - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: twocols - -Introduction ------------- - -Welcome to the documentation site for the official MongoDB Rust driver. -You can add the driver to your application to work with MongoDB in -Rust. Download it from `crates.io `__ -or set up a runnable project with examples from our Usage Guide. - -- `The Rust Driver Manual `__ - -- `API Reference `__ - -- `Changelog `__ - -- `Source Code `__ - -Installation ------------- - -See `Installation `__ - -.. _connect-atlas-rust-driver: - -Connect to MongoDB Atlas ------------------------- - -You can use the connection snippets in the following tabs to test your -connection to your MongoDB deployment on Atlas. Select from the -:guilabel:`Sync` or :guilabel:`Async` tabs below for corresponding -connection code samples. - -.. tabs:: - - .. tab:: Async - :tabid: rust-async - - .. note:: - - The default async runtime used by the driver is ``tokio``. To use a - different runtime, see - `Configuring the async runtime `__. - - .. literalinclude:: /includes/connection-snippets/scram/rust-connection-async.rs - :language: rust - - .. tab:: Sync - :tabid: rust-sync - - .. important:: - - You must enable the sync API in your application to use the - synchronous framework. See - `Enabling the sync API `__ - for more details. - - .. literalinclude:: /includes/connection-snippets/scram/rust-connection-sync.rs - :language: rust - -This connection snippet uses the {+stable-api+} feature, which you can -enable when using the Rust driver v2.0 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-php-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 connection snippets in the following -tabs to test your connection to your MongoDB deployment on Atlas. Select from the -:guilabel:`Sync` or :guilabel:`Async` tabs below for corresponding -connection code samples. - -.. tabs:: - - .. tab:: Async - :tabid: rust-async-no-stableapi - - .. note:: - - The default async runtime used by the driver is ``tokio``. To use a - different runtime, see - `Configuring the async runtime `__. - - .. literalinclude:: /includes/connection-snippets/scram/rust-connection-no-stableapi-async.rs - :language: rust - - .. tab:: Sync - :tabid: rust-sync-no-stableapi - - .. important:: - - You must enable the sync API in your application to use the - synchronous framework. See - `Enabling the sync API `__ - for more details. - - .. literalinclude:: /includes/connection-snippets/scram/rust-connection-no-stableapi-sync.rs - :language: rust - -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 -~~~~~~~~~~~~~~~~~~~~~ - -.. sharedinclude:: dbx/lifecycle-schedule-callout.rst - -.. include:: /includes/mongodb-compatibility-table-rust.rst - -Language Compatibility -~~~~~~~~~~~~~~~~~~~~~~ - -.. include:: /includes/language-compatibility-table-rust.rst - -.. include:: /includes/about-driver-compatibility.rst - -.. include:: /includes/help-links-rust.rst