/mongo-proxy

A proxy for mongodb, written in Java

Primary LanguageJavaOtherNOASSERTION

Mongo Proxy

Maven Build Status Coverage Status

A proxy for MongoDB written in Java. Using this proxy allows to easily trigger additional actions when data is inserted in the database

Developement now takes place at https://gitlab.cylab.be/cylab/mongo-proxy

Example

// port on which the proxy will be listening 
int PORT = 9632;
ProxyServer srv = new ProxyServer(PORT);
srv.addListener("admin.$cmd", new Listener() {
    @Override
    public void run(Document doc) {
        System.out.println("Notified: " + doc);
    }
});
srv.run();

MongoDb Wire Protocol Structure

this table shows the structure of the driver message for different version of driver and command done.

Version of mongodb driver Command Mongodb Wire protocol
3.5 db/collection/insertOne(document) opCode = Op_Query
. . fullCollectionName = dbName.$cmd
. . Document = [insert:collectionName, ordered:true, documents:[...] ]