| Crates.io | bevy_mongodb_asset |
| lib.rs | bevy_mongodb_asset |
| version | 0.1.0 |
| created_at | 2026-01-07 14:32:30.055908+00 |
| updated_at | 2026-01-07 14:32:30.055908+00 |
| description | Load Bevy assets from MongoDB |
| homepage | |
| repository | https://github.com/mongodb/mongo-rust-driver |
| max_upload_size | |
| id | 2028334 |
| size | 133,788 |
Load assets from MongoDB.
The asset plugin requires a mongodb::Client and must be constructed in the same tokio runtime as that client:
let tokio_rt = tokio::runtime::Runtime::new().unwrap();
let plugin = tokio_rt.block_on(async {
let client = mongodb::Client::with_uri_str(<URI>).await.unwrap();
MongodbAssetPlugin::new(&client).await
});
bevy::app::App::new()
.add_plugins(plugin)
...
.run();
Assets can be loaded either from BSON documents or from GridFS.
BSON document assets use the path structure mongodb://document/<database>/<collection>/<name>, and fetch data from a BSON object with the shape:
{
name: <String>,
data: <Binary>
}
Bevy metadata is optionally loaded from an object with the same shape in the collection named with an additional .meta suffix.
GridFS assets use the path structure mongodb://gridfs/<database>/<bucket>/<name>. Bevy metadata is optionally loaded from the GridFS file metadata document field bevyAsset.
| Bevy | bevy_mongodb_asset |
|---|---|
| 0.17 | 0.1 |