Skip to content

Commit c331aca

Browse files
committed
(DOCSP-8172) - adds Rust driver content
1 parent 09f1b2d commit c331aca

File tree

6 files changed

+126
-0
lines changed

6 files changed

+126
-0
lines changed

source/drivers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ For information on MongoDB licensing, see `MongoDB Licensing
4545
Mongoid ODM <https://docs.mongodb.com/mongoid/current/>
4646
Scala Driver </drivers/scala>
4747
Swift Driver </drivers/swift>
48+
Rust Driver </drivers/rust>
4849

4950
MongoDB ODM (Object-Document-Mapper)
5051
------------------------------------

source/drivers/rust.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
.. _rust-language-center:
2+
3+
.. include:: /includes/unicode-checkmark.rst
4+
5+
===================
6+
MongoDB Rust Driver
7+
===================
8+
9+
.. default-domain:: mongodb
10+
11+
.. contents:: On this page
12+
:local:
13+
:backlinks: none
14+
:depth: 1
15+
:class: twocols
16+
17+
Introduction
18+
------------
19+
20+
This is the official MongoDB Rust Driver.
21+
22+
.. admonition:: Alpha Release
23+
:class: important
24+
25+
The MongoDB Rust Driver is currently in alpha.
26+
27+
- `Usage Guide <https://github.com/mongodb/mongo-rust-driver#example-usage>`__
28+
29+
- `API Reference <https://docs.rs/mongodb/latest/mongodb/>`__
30+
31+
- `Changelog <https://github.com/mongodb/mongo-rust-driver/releases>`__
32+
33+
- `Source Code <https://github.com/mongodb/mongo-rust-driver/>`__
34+
35+
36+
Installation
37+
------------
38+
39+
See `Installation <https://github.com/mongodb/mongo-rust-driver#Installation>`__
40+
41+
42+
Connect to MongoDB Atlas
43+
------------------------
44+
45+
To connect to a :atlas:`MongoDB Atlas </>` cluster, use the :atlas:`Atlas connection string </driver-connection>` for your cluster:
46+
47+
.. code-block:: rust
48+
49+
use bson::doc;
50+
use mongodb::{options::ClientOptions, Client};
51+
52+
fn main() -> mongodb::error::Result<()> {
53+
// Parse a connection string into an options struct.
54+
let mut client_options =
55+
ClientOptions::parse("mongodb+srv://<username>:<password>@<cluster-url>/test?w=majority")?;
56+
57+
// Manually set an option.
58+
client_options.app_name = Some("Rust Demo".to_string());
59+
60+
// Get a handle to the deployment.
61+
let client = Client::with_options(client_options)?;
62+
63+
client
64+
.database("admin")
65+
.run_command(doc! {"ping": 1}, None)?;
66+
println!("Connected successfully.");
67+
68+
// List the names of the databases in that deployment.
69+
for db_name in client.list_database_names(None)? {
70+
println!("{}", db_name);
71+
}
72+
Ok(())
73+
}
74+
75+
Compatibility
76+
-------------
77+
78+
MongoDB Compatibility
79+
~~~~~~~~~~~~~~~~~~~~~
80+
81+
.. include:: /includes/mongodb-compatibility-table-rust.rst
82+
83+
Language Compatibility
84+
~~~~~~~~~~~~~~~~~~~~~~
85+
86+
.. include:: /includes/language-compatibility-table-rust.rst
87+
88+
.. include:: /includes/help-links-rust.rst

source/includes/driver-table.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@
107107
- `API <https://mongodb.github.io/mongo-swift-driver/>`__
108108
- :issue:`JIRA <SWIFT>`
109109
-
110+
111+
* - :doc:`Rust </drivers/rust>`
112+
- `Releases <https://github.com/mongodb/mongo-rust-driver/releases>`__
113+
- `Source <https://github.com/mongodb/mongo-rust-driver>`__
114+
- `API <https://docs.rs/mongodb/latest/mongodb/>`__
115+
- :issue:`JIRA <RUST>`
116+
-
110117
..
111118
* - :doc:`Haskell </drivers/haskell>`
112119
- `Releases <https://github.com/mongodb/mongodb-haskell/releases>`__

source/includes/help-links-rust.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
How to get help
2+
---------------
3+
4+
- Ask questions on our :community-forum:`MongoDB Community Forums <>`.
5+
- Visit our :technical-support:`Support Channels </>`.
6+
- See our :issue:`RUST <RUST>` JIRA project to raise issues or request
7+
features.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The MongoDB Rust driver requires Rust 1.39 or later.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.. list-table::
2+
:header-rows: 1
3+
:stub-columns: 1
4+
:class: compatibility-large
5+
6+
* - Rust Driver
7+
- MongoDB 4.2
8+
- MongoDB 4.0
9+
- MongoDB 3.6
10+
- MongoDB 3.4
11+
- MongoDB 3.2
12+
- MongoDB 3.0
13+
- MongoDB 2.6
14+
15+
* - 0.9.x
16+
- |checkmark|
17+
- |checkmark|
18+
- |checkmark|
19+
-
20+
-
21+
-
22+
-

0 commit comments

Comments
 (0)