This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use mongodb::{bson::doc, options::ClientOptions, sync::Client}; | |
| fn main() -> mongodb::error::Result<()> { | |
| // Parse your connection string into an options struct | |
| let client_options = | |
| ClientOptions::parse("<connection string>")?; | |
| // Get a handle to the cluster | |
| let client = Client::with_options(client_options)?; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use mongodb::{bson::doc, options::{ClientOptions, ServerApi, ServerApiVersion}, sync::Client}; | |
| fn main() -> mongodb::error::Result<()> { | |
| // Parse your connection string into an options struct | |
| let mut client_options = | |
| ClientOptions::parse("<connection string>")?; | |
| // 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use mongodb::{bson::doc, options::ClientOptions, Client}; | |
| #[tokio::main] | |
| async fn main() -> mongodb::error::Result<()> { | |
| // Parse your connection string into an options struct | |
| let client_options = | |
| ClientOptions::parse("<connection string>") | |
| .await?; | |
| // Get a handle to the cluster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use mongodb::{bson::doc, options::{ClientOptions, ServerApi, ServerApiVersion}, Client}; | |
| #[tokio::main] | |
| async fn main() -> mongodb::error::Result<()> { | |
| // Parse your connection string into an options struct | |
| let mut client_options = | |
| ClientOptions::parse("<connection string>") | |
| .await?; | |
| // Set the server_api field of the client_options object to Stable API version 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using MongoDB.Driver; | |
| using MongoDB.Bson; | |
| // Replace the placeholders with your credentials | |
| const string connectionUri = "<connection string>"; | |
| var settings = MongoClientSettings.FromConnectionString(connectionUri); | |
| // Set the ServerApi field of the settings object to Stable API version 1 | |
| settings.ServerApi = new ServerApi(ServerApiVersion.V1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using MongoDB.Driver; | |
| using MongoDB.Bson; | |
| // Replace the placeholders with your credentials | |
| const string connectionUri = "<connection string>"; | |
| var settings = MongoClientSettings.FromConnectionString(connectionUri); | |
| // Create a new client and connect to the server | |
| var client = new MongoClient(settings); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import-module .\psake.psm1 | |
| invoke-psake @args | |
| remove-module psake |