[ANN] Mongoc.jl v0.1.0 - a MongoDB driver for Julia

GitHub - felipenoris/Mongoc.jl: MongoDB driver for the Julia Language is a MongoDB driver for Julia.

It supports recent MongoDB features, like Sessions and Transactions. And also authentication, aggregation, map-reduce and BSON parsing.

There’s a comprehensive documentation at Home · Mongoc.jl .

It’s a sweet package, in the sense that it is loaded with some syntactic sugar. As an example, this is how you would make a transaction:

import Mongoc

# connect to a Replica Set
client = Mongoc.Client("mongodb://127.0.0.1:27021,127.0.0.1:27022,127.0.0.1:27023/?replicaSet=rs0")

Mongoc.transaction(client) do session
    database = session["my_database"]
    collection = database["my_collection"]
    new_item = Mongoc.BSON()
    new_item["inserted"] = true
    push!(collection, new_item)
end

In PyMongo, for a comparison, you would have to manually link database operations to the session.

I would also like to point out the difference between this package and LibBSON.jl/Mongo.jl, which I also have contributed recently : Mongoc.jl links to the new mongoc library, while LibBSON.jl and Mongo.jl uses an old C driver. So an update would make a lot of breaking changes, and this is why I tried to code Mongoc.jl from scratch.

For those of you who would like to contribute, please help me find possible memory leaks.

Enjoy!

14 Likes

This is awesome!!

1 Like