{"id":15063663,"url":"https://github.com/almightycouch/rethinkdb_ecto","last_synced_at":"2025-10-05T00:31:01.642Z","repository":{"id":57543602,"uuid":"50882922","full_name":"almightycouch/rethinkdb_ecto","owner":"almightycouch","description":"RethinkDB adapter for Ecto.","archived":true,"fork":false,"pushed_at":"2018-08-09T13:35:34.000Z","size":112,"stargazers_count":114,"open_issues_count":4,"forks_count":18,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-08-29T22:55:15.292Z","etag":null,"topics":["adapter","ecto","elixir","rethinkdb"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/rethinkdb_ecto","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/almightycouch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-02T00:48:37.000Z","updated_at":"2023-02-17T23:44:52.000Z","dependencies_parsed_at":"2022-08-27T18:51:27.683Z","dependency_job_id":null,"html_url":"https://github.com/almightycouch/rethinkdb_ecto","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/almightycouch/rethinkdb_ecto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almightycouch%2Frethinkdb_ecto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almightycouch%2Frethinkdb_ecto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almightycouch%2Frethinkdb_ecto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almightycouch%2Frethinkdb_ecto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/almightycouch","download_url":"https://codeload.github.com/almightycouch/rethinkdb_ecto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/almightycouch%2Frethinkdb_ecto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278395870,"owners_count":25979685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adapter","ecto","elixir","rethinkdb"],"created_at":"2024-09-25T00:05:37.400Z","updated_at":"2025-10-05T00:31:01.319Z","avatar_url":"https://github.com/almightycouch.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RethinkDB.Ecto\n\n[![Travis](https://img.shields.io/travis/almightycouch/rethinkdb_ecto.svg)](https://travis-ci.org/almightycouch/rethinkdb_ecto)\n[![Hex.pm](https://img.shields.io/hexpm/v/rethinkdb_ecto.svg)](https://hex.pm/packages/rethinkdb_ecto)\n[![Documentation Status](https://img.shields.io/badge/docs-hexdocs-blue.svg)](http://hexdocs.pm/rethinkdb_ecto)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/almightycouch/rethinkdb_ecto/master/LICENSE)\n[![Github Issues](https://img.shields.io/github/issues/almightycouch/rethinkdb_ecto.svg)](http://github.com/almightycouch/rethinkdb_ecto/issues)\n\nRethinkDB adapter for Ecto **2.1.x** (see issue [#41](https://github.com/almightycouch/rethinkdb_ecto/issues/41) for Ecto 2.2.x support).\n\n## Installation\n\nAdd `:rethinkdb_ecto` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [{:rethinkdb_ecto, \"~\u003e 0.7\"}]\nend\n```\n\nFinally, in the repository configuration, you will need to specify the `:adapter`:\n\n```elixir\nconfig :my_app, MyApp.Repo,\n  adapter: RethinkDB.Ecto,\n  ...\n```\n\n## Setup\n\nFirst, create you repository with `mix ecto.gen.repo` and add the repository to you config:\n\n```elixir\nconfig :my_app, ecto_repos: [MyApp.Repo]\n```\n\nStart the repository as a supervisor on your application’s supervisor:\n\n```elixir\ndef start(_type, _args) do\n  import Supervisor.Spec\n\n  children = [\n    supervisor(MyApp.Repo, [])\n  ]\n\n  opts = [strategy: :one_for_one, name: MyApp.Supervisor]\n  Supervisor.start_link(children, opts)\nend\n```\n\nDefine your schema:\n\n```elixir\ndefmodule User do\n  use Ecto.Schema\n\n  # You must define your primary-key and foreign-key types as :binary_id\n  @primary_key {:id, :binary_id, autogenerate: false}\n  @foreign_key_type :binary_id\n\n  schema \"users\" do\n    field :name, :string\n    field :age, :integer\n    has_many :posts, Post\n    timestamps\n  end\nend\n```\n\nAnd the matching migration:\n\n```elixir\ndefmodule UserMigration do\n  use Ecto.Migration\n\n  def change do\n    create table(\"users\")\n    create index(\"users\", [:name])\n  end\nend\n```\n\nCreate the database and apply migrations:\n\n```\n$ mix ecto.create\n$ mix ecto.migrate\n```\n\nYou are ready to go.\n\n## Usage\n\nThe adapter supports almost all of `Ecto.Query` functions. This includes group-by and order-by clauses,\naggregators, ranges, complex filter and select queries, etc.\n\nStart a IEx shell and run a few basic queries:\n\n```elixir\niex(2)\u003e MyApp.Repo.insert %Post{title: \"Ecto is great!\"}\niex(3)\u003e MyApp.Repo.one Post\n```\n\nYou can build relationships using `:belongs_to`, `has_one`, `has_many`, etc. in your schema definitions and use them to load associations:\n\n```elixir\niex(4)\u003e MyApp.Repo.all(Post) |\u003e MyApp.Repo.preload(:comments)\n```\n\n`RethinkDB.Ecto` provides support for `:inner_join` (default), which means that you can preload relationships within a single query:\n\n```elixir\niex(5)\u003e MyApp.Repo.all from p in Post,\n...(5)\u003e               join: u in assoc(p, :author),\n...(5)\u003e               join: c in assoc(p, :comments),\n...(5)\u003e              where: u.name == \"Theresia\",\n...(5)\u003e            preload: [author: u, comments: c]\n```\n\n## Limitations\n\nCheck the *known limitations*  section in the `RethinkDB.Ecto` documentation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmightycouch%2Frethinkdb_ecto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falmightycouch%2Frethinkdb_ecto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falmightycouch%2Frethinkdb_ecto/lists"}