bevy_mongodb_asset

Crates.iobevy_mongodb_asset
lib.rsbevy_mongodb_asset
version0.1.0
created_at2026-01-07 14:32:30.055908+00
updated_at2026-01-07 14:32:30.055908+00
descriptionLoad Bevy assets from MongoDB
homepage
repositoryhttps://github.com/mongodb/mongo-rust-driver
max_upload_size
id2028334
size133,788
(mongo-rust-driver)

documentation

README

Bevy MongoDB Assets

Crates.io docs.rs License

Load assets from MongoDB.

Initialization

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();

Usage

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 Compatibility

Bevy bevy_mongodb_asset
0.17 0.1
Commit count: 1290

cargo fmt