Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/checkiz/elixir-mongo
MongoDB driver for Elixir
https://github.com/checkiz/elixir-mongo
Last synced: about 1 month ago
JSON representation
MongoDB driver for Elixir
- Host: GitHub
- URL: https://github.com/checkiz/elixir-mongo
- Owner: checkiz
- License: mit
- Created: 2014-01-23T19:30:48.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-10-28T13:50:05.000Z (about 7 years ago)
- Last Synced: 2024-10-05T21:17:57.121Z (2 months ago)
- Language: Elixir
- Homepage:
- Size: 273 KB
- Stars: 101
- Watchers: 8
- Forks: 31
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - MongoDB driver for Elixir. (ORM and Datamapping)
- fucking-awesome-elixir - mongo - MongoDB driver for Elixir. (ORM and Datamapping)
- awesome-elixir - mongo - MongoDB driver for Elixir. (ORM and Datamapping)
README
elixir-mongo
============
[![Build Status](https://travis-ci.org/checkiz/elixir-mongo.png?branch=master)](https://travis-ci.org/checkiz/elixir-mongo) [![Hex Version](https://img.shields.io/hexpm/v/mongo.svg)](https://hex.pm/packages/mongo)
[![Hex Downloads](https://img.shields.io/hexpm/dt/bson.svg)](https://hex.pm/packages/mongo)A [MongoDB](http://www.mongodb.org) driver in Elixir.
API entirely reviewed, see [CHANGELOG.md](https://github.com/checkiz/elixir-mongo/blob/master/CHANGELOG.md)
### Connecting
Example preparing access to the `anycoll` collection in the `test` db :
```elixir
# Connect the mongo server (by default port 27017 at 127.0.0.1)
mongo = Mongo.connect!
# Select the db to access
db = mongo |> Mongo.db("test")
# Select the db to access
anycoll = db |> Mongo.Db.collection("anycoll")
```### Wrappers for CRUD operations
Examples accessing the `anycoll` collection via CRUD operations see `Mongo.Find`
### Wrappers for Aggregate operations
Example of aggregate operation applied to the `anycoll` collection see `Mongo.Collection`
### Other commands
```elixir
# Authenticate against the db
db |> Mongo.auth("testuser", "123")`
# Retrieve the last error
db |> Mongo.getLastError
```### Documentation
- [documentation](http://checkiz.github.io/elixir-mongo)
### Dependencies
- MongoDB needs a Bson encoder/decoder, this project uses the elixir-bson encoder/decoder. See [elixir-bson source repo](https://github.com/checkiz/elixir-bson) and its
[documentation](http://checkiz.github.io/elixir-bson)