1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00
examples/databases/mongodb/README.md

18 lines
882 B
Markdown
Raw Permalink Normal View History

# MongoDB
2024-07-07 03:03:51 +02:00
Simple example of MongoDB usage with Actix Web. For more information on the MongoDB Rust driver, visit the [documentation](https://docs.rs/mongodb/3) and [source code](https://github.com/mongodb/mongo-rust-driver).
## Usage
### Install MongoDB
2022-03-06 01:43:10 +01:00
Visit the [MongoDB Download Center](https://www.mongodb.com/try) for instructions on how to use MongoDB Atlas or set up MongoDB locally.
### Set an environment variable
2022-03-06 01:43:10 +01:00
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](https://docs.mongodb.com/manual/reference/connection-string/) entry in the MongoDB manual.
### Run the example
2022-02-18 03:13:55 +01:00
To execute the example code, run `cargo run` in the `databases/mongodb` directory.