bevy_mongodb_asset 0.1.0

Load Bevy assets from MongoDB
Documentation

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