All Projects β†’ kobil-systems β†’ Mongodb_ecto

kobil-systems / Mongodb_ecto

MongoDB adapter for Ecto

Programming Languages

elixir
2628 projects

Labels

Projects that are alternatives of or similar to Mongodb ecto

elixir-revisionair ecto
A Revisionair adapter based on Ecto. Allows you to persist and keep track of revisions of your data structures in any of Ecto's supported databases.
Stars: ✭ 18 (-94.34%)
Mutual labels:  ecto
bourne
🚀 Better streaming for Ecto.
Stars: ✭ 71 (-77.67%)
Mutual labels:  ecto
flop
Filtering, ordering and pagination for Ecto
Stars: ✭ 56 (-82.39%)
Mutual labels:  ecto
hierarch
Tree structure & hierarchy for ecto models with ltree(Postgres)
Stars: ✭ 30 (-90.57%)
Mutual labels:  ecto
ecto conditionals
EctoConditionals implements a flexibly functional find_or_create and upsert behavior for Ecto models.
Stars: ✭ 17 (-94.65%)
Mutual labels:  ecto
pretty print formatter
Pretty Print Formatter for Elixir Logger module -- Colorize Ecto's SQL ouput πŸ–ŒοΈ
Stars: ✭ 22 (-93.08%)
Mutual labels:  ecto
contextual
🌈 Generate your Ecto contexts using this macro and eliminate boilerplate
Stars: ✭ 18 (-94.34%)
Mutual labels:  ecto
one plus n detector
Elixir library to help you detect 1+n queries in applications using Ecto
Stars: ✭ 20 (-93.71%)
Mutual labels:  ecto
ex sieve
Implement dynamic filtering and sorting API for Ecto queries
Stars: ✭ 37 (-88.36%)
Mutual labels:  ecto
ecto generator
Generate Ecto schemas from existing database in Phoenix - Elixir
Stars: ✭ 20 (-93.71%)
Mutual labels:  ecto
exqlite
An SQLite3 driver for Elixir
Stars: ✭ 128 (-59.75%)
Mutual labels:  ecto
ecto commons
Ecto common validators for Date, Time, URLs, Emails, PostalCodes, Phone Numbers, Luhn checks, etc.
Stars: ✭ 33 (-89.62%)
Mutual labels:  ecto
comeonin ecto password
Ecto type for saving encrypted passwords using Comeonin
Stars: ✭ 34 (-89.31%)
Mutual labels:  ecto
ecto nested changeset
Helpers for manipulating nested Ecto changesets
Stars: ✭ 23 (-92.77%)
Mutual labels:  ecto
ecto diff
Generates a data structure describing the difference between two ecto structs
Stars: ✭ 22 (-93.08%)
Mutual labels:  ecto
monetized
A lightweight solution for handling and storing money.
Stars: ✭ 46 (-85.53%)
Mutual labels:  ecto
txbox
Elixir Bitcoin transaction storage schema, built on Ecto.
Stars: ✭ 14 (-95.6%)
Mutual labels:  ecto
Triplex
Database multitenancy for Elixir applications!
Stars: ✭ 261 (-17.92%)
Mutual labels:  ecto
ecto autoslug field
Automatically create slugs for Ecto schemas.
Stars: ✭ 138 (-56.6%)
Mutual labels:  ecto
commanded-ecto-projections
Read model projections for Commanded using Ecto
Stars: ✭ 68 (-78.62%)
Mutual labels:  ecto

Mongo.Ecto

Travis Build Status Coveralls Coverage Inline docs

Mongo.Ecto is a MongoDB adapter for Ecto.

For detailed information read the documentation for the Mongo.Ecto module, or check out examples below.

Features still missing to be Ecto 2.1 compliant

  • on_conflict

Example

# In your config/config.exs file
config :my_app, Repo,
  adapter: Mongo.Ecto,
  database: "ecto_simple",
  username: "mongodb",
  password: "mongosb",
  hostname: "localhost"

# In your application code
defmodule Repo do
  use Ecto.Repo, otp_app: :my_app
end

defmodule Weather do
  use Ecto.Model

  @primary_key {:id, :binary_id, autogenerate: true}
  schema "weather" do
    field :city     # Defaults to type :string
    field :temp_lo, :integer
    field :temp_hi, :integer
    field :prcp,    :float, default: 0.0
  end
end

defmodule Simple do
  import Ecto.Query

  def sample_query do
    query = from w in Weather,
          where: w.prcp > 0 or is_nil(w.prcp),
         select: w
    Repo.all(query)
  end
end

Usage

Add Mongo.Ecto as a dependency in your mix.exs file.

def deps do
  [{:mongodb_ecto, "~> 0.1"}]
end

You should also update your applications to include both projects.

def application do
  [applications: [:logger, :mongodb_ecto, :ecto]]
end

To use the adapter in your repo:

defmodule MyApp.Repo do
  use Ecto.Repo,
    otp_app: :my_app,
    adapter: Mongo.Ecto
end

For additional information on usage please see the documentation for Ecto.

Data Type Mapping

BSON Ecto
double :float
string  :string
object :map
array {:array, subtype}
binary data :binary
binary data (uuid) Ecto.UUID
object id :binary_id
boolean :boolean
date Ecto.DateTime
regular expression Mongo.Ecto.Regex
JavaScript Mongo.Ecto.JavaScript
symbol (see below)
32-bit integer :integer
timestamp BSON.Timestamp
64-bit integer :integer

Symbols are deprecated by the BSON specification. They will be converted to simple strings on reads. There is no possibility of persisting them to the database.

Additionally special values are translated as follows:

BSON Ecto
null nil
min key :BSON_min
max key :BSON_max

Supported Mongo versions

The adapter and the driver are tested against most recent versions from 3 branches: 2.4.x, 2.6.x, 3.0.x

Contributing

To contribute you need to compile Mongo.Ecto from source and test it:

$ git clone https://github.com/ankhers/mongodb_ecto.git
$ cd mongodb_ecto
$ mix test

License

Copyright 2015 MichaΕ‚ MuskaΕ‚a

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].