A Rust library for iterating over a MongoDB replica set oplog.
Current version: 0.1.0
Supported Rust versions: 1.14
Install Oplog by adding the following to your Cargo.toml
:
toml
oplog = "0.1.0"
```rust
extern crate bson; extern crate mongodb; extern crate oplog;
use mongodb::{Client, ThreadedClient}; use oplog::{Oplog, OplogBuilder};
fn main() { let client = Client::connect("localhost", 27017).expect("Failed to connect to MongoDB.");
if let Ok(oplog) = Oplog::new(&client) {
for doc in oplog {
println!("{}", doc);
}
}
// Or, if you want to filter out certain operations:
if let Ok(oplog) = OplogBuilder::new(&client).filter(Some(doc! { "op" => "i" })).build() {
for insert in oplog {
println!("{}", insert);
}
}
} ```
Full API documentation is available at http://mudge.name/oplog
And many thanks to Ryman for his help along the way.
Copyright © 2016 Paul Mucur.
Distributed under the MIT License.