zookzook

zookzook

MongoDB driver - an alternative MongoDB driver

Announcing an alternative MongoDB Driver! Do you like the MongoDB despite the general opinion a database always has to be an sql database? Would you like to use your favorite database with your favorite language? Then you are right here!

Sadly there is no official driver (I do not know why?). So you have to take things into your own hands and write the driver yourself. Currently the implementation does not support all features yet. But over time (hopefully) the succesive expansion of the missing features will take place.

Features:

  • Supports MongoDB versions 3.2, 3.4, 3.6, 4.0
  • Connection pooling (through DBConnection 2.x)
  • Streaming cursors
  • Performant ObjectID generation
  • Follows driver specification set by 10gen
  • Safe (by default) and unsafe writes
  • Aggregation pipeline
  • Replica sets
  • Support for SCRAM-SHA-256 (MongoDB 4.x)
  • Support for change streams api (See)

More information, sources and packages:
github hex.pm

Most Liked

zookzook

zookzook

The new version 0.6.0 has been released. Additional features since last announcing (May 4):

  • Support for bulk writes (See specs)

  • support for driver sessions (See specs)

  • support driver transactions (See specs)

  • Enhancements

    • refactored writeConcern
    • refactored filter_nils
    • refactored usage of ReadPreference
    • added support for sessions ( ServerSession , SessionPool , Session )
    • added Decimal128 encoder
    • added support for transactions
    • added support for transaction to gridfs and bulk operation
    • added create command (explicitly creating a collection or view)
    • Supports MongoDB versions 3.2, 3.4, 3.6, 4.0, 4.2

Check the documentation for more information:

zookzook

zookzook

Announcing a helper library to support using structs instead of bare maps while using the MongoDB-Driver:

Hex.pm
Github
Demo

Features:

  • automatic load and dump function
  • reflection functions
  • type specification
  • support for embedding one and many structs
  • support for after load function
  • support for before dump function
  • support for id generation
  • support for default values
  • support for derived values

The module creates some boilerplate code, so you can use structs for your data. You call load/1 to convert the map from the driver to your struct. To save your struct to MongoDB you call dump/1 before you call insert_one or insert_many.

Check out the docs!

zookzook

zookzook

let me say: tempus fugit.

mongox - DEPRECATED
mongo - 0.5.4 December 1, 2015 (docs)
mongodb_erlang - seems not to support op_msg (since 3.6)

Unfortunately, the libraries are not up-to-date regarding the MongoDB server. Since I use the latest version of my projects and therefore want to use the features of the server, I was looking for a suitable driver. Unfortunately I did not find one, so I searched for the best starting point and developed my own driver.

zookzook

zookzook

The new version 1.0.0 has been released:

Enhancements:

  • add migration (da65de4)
  • improve the dump and load functions (#154) (e7f2d44)
  • use the same timestamps in new/0 function (0db61da)

Bugfix:

  • remove a bug in the hello handshake protocol (thanks to fireproofsocks for reporting) (59aa841)
  • remove derived attributes in the dump function (c1b60b4)

Breaking changes - Mongo.Repo and Collections Module

Prior to version 0.9.2 the dump/1 function returns atoms as key. Since the dump/1 function is the inverse function of load/1, which uses binary keys as default, the dump/1 function should return binary keys as well.

Prior to version 0.9.2 some Mongo.Repo functions use the dump/1 function for the query (and update) parameter. This worked only for some query that used only the attributes of the document. In the case of nested documents, it didn’t work, so it is changed to be more consistent. The Mongo.Repo module is very simple without any query rewriting like Ecto does. In the case you want to use the :name option, you need to specify the query and update documents in the Mongo.Repo functions following the specification in the MongoDB.

If you upgrade the driver to version 1.0.0 and you use the collection feature, please check you code!

zookzook

zookzook

The new version 0.7.0 has been released:

  • support for command monitoring
  • support for retryable reads
  • support for retryable writes

Enhancements:

  • refactored the api of Mongo.limits and Mongo.wire_version
  • add support for tracking recovery token from response in a sharded transaction
  • new function BSON.ObjectId.decode/1 and BSON.ObjectId.encode/1
  • new function Mongo.uuid/1
  • refactored event notification system
  • refactored the test cases
  • now using mtools for a MongoDB deployment in the travis ci environment
  • Session.commit_transaction returns now :ok or an error {:error, %Mongo.Error{}}
  • support for errorLabels

Where Next?

Popular in Libraries Top

devonestes
Introducing assertions, the library that helps you write really great test assertions! GitHub: https://github.com/devonestes/assertions ...
New
sabiwara
Dune is a sandbox for Elixir and aims to safely evaluate user-provided code. You can try it out using this basic Elixir playground made ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
wmnnd
Hi there, for my project DBLSQD, I needed a file storage solution that is a bit more flexible than Arc. Because I thought others might f...
New
ericlathrop
I built a silly site for Halloween that uses Phoenix Channels on the backend, and React on the frontend. I had many problems integrating ...
New
mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story <- Meeseeks.all(html, css("tr.athing")) do...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Sub Categories:

We're in Beta

About us Mission Statement