1
0
mirror of https://github.com/actix/examples synced 2024-12-18 00:13:57 +01:00
examples/databases/mongodb
2024-02-20 03:29:12 +00:00
..
src chore: remove redundant imports 2024-02-20 03:29:12 +00:00
Cargo.toml move serde deps to workspace 2023-01-02 20:35:11 +00:00
README.md format markdown 2022-03-06 00:43:10 +00: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 databases/mongodb directory.