Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/valencian-digital/planter
Blazingly fast data generation for MongoDB
https://github.com/valencian-digital/planter
data-generation database mongodb rust seeding
Last synced: 12 days ago
JSON representation
Blazingly fast data generation for MongoDB
- Host: GitHub
- URL: https://github.com/valencian-digital/planter
- Owner: valencian-digital
- Created: 2021-09-25T19:15:14.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-06T19:59:36.000Z (over 2 years ago)
- Last Synced: 2024-08-02T05:23:15.508Z (3 months ago)
- Topics: data-generation, database, mongodb, rust, seeding
- Language: Rust
- Homepage:
- Size: 75.2 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-blazingly-fast - planter - Blazingly fast data generation for MongoDB (Rust)
README
# Planter
Blazingly fast and simple data generation & seeding for MongoDB## Installation
Use the package manager [cargo](https://pip.pypa.io/en/stable/) to install planter.
Add the following to your Cargo.toml
```toml
[dependencies]
planter = {git = "https://github.com/valencian-digital/planter", branch = "main"}# from online repo```
```
## Usage```rust
fn user_generator(_history: &planter::GeneratedData) -> bson::Document {
return doc! {
"_id": bson::Bson::ObjectId(bson::oid::ObjectId::new()),
"name": "Jane Doe"
};
}...
let documents_per_collection = 1000;
let collections: Vec<(String, planter::EntityGenerator)> = vec![
(String::from("users"), user_generator),
];planter::seed_data(
collections,
planter::Configurations::new(documents_per_collection, planter::SeedMode::Disk),
);
```Then to import that data into your running MongoDB database, execute the following command:
```bash
mongorestore --db=test data/
```
Look at the [mongorestore](https://docs.mongodb.com/database-tools/mongorestore/#std-label-mongorestore-examples) documentation in order to see all of options## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)