[][src]Module hive_pubsub::backend::mongo

This is supported on crate feature mongo only.

MongoDB backend

This is suitable for small applications, but does have several drawbacks.

All data is serialized into a JSON string which is embedded into a Mongo document.

Example

use mongodb::sync::Client;
use hive_pubsub::{PubSub};
use hive_pubsub::backend::mongo::MongodbPubSub;

let client = Client::with_uri_str("bruh").unwrap();
let hive = MongodbPubSub::<i32, i32, String>::new(
    |ids, data| {
        // do something with the data.
    },
    client.database("hive").collection("pubsub")
);
 
// ... do what you would usually do

Structs

MongodbPubSubmongo

MongoDB pubsub

Functions

listen_threadmongo

Helper function to spawn a listener thread.