1
0
mirror of https://github.com/actix/examples synced 2024-11-30 17:14:35 +01:00
examples/database_interactions/mongodb
Luca Palmieri 5dec713add
Update database-interactions/mongo-db to the latest v4 beta (#508)
Co-authored-by: Rob Ede <robjtede@icloud.com>
2022-02-02 15:15:25 +00:00
..
src Update database-interactions/mongo-db to the latest v4 beta (#508) 2022-02-02 15:15:25 +00:00
Cargo.toml Update database-interactions/mongo-db to the latest v4 beta (#508) 2022-02-02 15:15:25 +00:00
README.md Add MongoDB example (#452) 2021-10-06 22:23:12 +01:00

MongoDB

Simple example of MongoDB usage with Actix web. For more information on the MongoDB Rust driver, visit the documentation and source code.

Usage

Install MongoDB

Visit the MongoDB Download Center for instructions on how to use MongoDB Atlas or set up MongoDB locally.

Set an environment variable

The example code creates a client with the URI set by the MONGODB_URI environment variable. The default URI for a standalone mongod running on localhost is "mongodb://localhost:27017". For more information on MongoDB URIs, visit the connection string entry in the MongoDB manual.

Run the example

To execute the example code, run cargo run in the database_interactions/mongodb directory.