Skip to content

[WIP] Support for Ecto 2.0 #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Feb 12, 2017
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
95f8c13
Loaders and dumpers for time and date types
ankhers Aug 9, 2016
a2e8c47
Fix a couple more tests
ankhers Aug 11, 2016
874d619
Fix regex queries
ankhers Aug 12, 2016
4a2f069
Comment out the javascript test for now
ankhers Aug 12, 2016
fce0159
fix update_all and insert_all tests
kwojtaszek Aug 15, 2016
0eaaaa3
Merge pull request #1 from appunite/ecto-2
ankhers Aug 16, 2016
0f23fa0
Revert back to ericmj repo
ankhers Aug 17, 2016
e72965a
Fix-up some tests
ankhers Aug 20, 2016
3392180
Test fix for in
ankhers Aug 22, 2016
c2d26b9
Fix a couple tests for update and delete
ankhers Aug 23, 2016
b5853b8
Following ecto's versions for travis
ankhers Aug 23, 2016
e5f5686
Fix selecting only explicit attributes
ankhers Aug 29, 2016
c2c2144
Implement ensure_all_started for Ecto.Adapter
ankhers Aug 29, 2016
eeb0da0
Temporarily point to my fork for mongodb
ankhers Aug 31, 2016
b3d1bba
Revert back to upstream mongo repo
ankhers Sep 15, 2016
a3454fe
update deps
ankhers Nov 6, 2016
e3236a1
Uncomment test I previously commented
ankhers Nov 10, 2016
36673c8
Update mongodb version
ankhers Nov 12, 2016
62f05c8
Update logging for Ecto 2
cjbell Nov 16, 2016
06577b3
pin ecto version; update mongodb version
ankhers Nov 16, 2016
7837c9b
Fix migration tests
ankhers Nov 16, 2016
9f3a163
Merge branch 'ecto-2' of https://github.com/ankhers/mongodb_ecto into…
cjbell Nov 16, 2016
6641f2e
Merge branch 'ecto-2' into logging-fixes
cjbell Nov 16, 2016
978e1a0
Fix loader for Ecto.Date
ankhers Nov 16, 2016
88df67e
Merge pull request #2 from madebymany/logging-fixes
ankhers Nov 16, 2016
6d557cf
Manually convert date/time structs to BSON.DateTime
ankhers Nov 19, 2016
2953f97
fix ecto.drop command
AlexKovalevych Dec 27, 2016
ebd1468
Fixed type casting tests
auser Dec 29, 2016
0b61b46
Merge pull request #6 from auser/ecto-2
ankhers Dec 29, 2016
cad75d1
fix ecto.migrate
AlexKovalevych Dec 30, 2016
e2a351c
fix logging (fails if limit greater that 1 is used)
AlexKovalevych Jan 1, 2017
2259ec4
fix get_more action logging
AlexKovalevych Jan 10, 2017
b6bd734
Merge pull request #7 from AlexKovalevych/fix-ecto-migrate
ankhers Jan 11, 2017
6ed4a28
Merge pull request #8 from AlexKovalevych/fix-logging
ankhers Jan 23, 2017
39c08cb
Cleaner way of checking for empty map
ankhers Feb 8, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement ensure_all_started for Ecto.Adapter
  • Loading branch information
ankhers committed Aug 29, 2016
commit c2c214462f57630907071f1ea4e24761a5daeaec
31 changes: 8 additions & 23 deletions lib/mongo_ecto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,14 @@ defmodule Mongo.Ecto do
Mongo.child_spec(opts)
end

@doc false
def ensure_all_started(repo, type) do
{_, opts} = repo.__pool__
with {:ok, pool} <- DBConnection.ensure_all_started(opts, type),
{:ok, mongo} <- Application.ensure_all_started(:mongodb, type),
do: {:ok, pool ++ [mongo]}
end

@doc false
def loaders(Ecto.Time, type), do: [&load_time/1, type]
def loaders(Ecto.Date, type), do: [&load_date/1, type]
Expand Down Expand Up @@ -563,29 +571,6 @@ defmodule Mongo.Ecto do

Connection.update(repo, normalized, opts)
end
def update(_repo, meta, _fields, _filter, {key, :id, _}, _returning, _opts) do
raise ArgumentError,
"MongoDB adapter does not support :id field type in models. " <>
"The #{inspect key} field in #{inspect meta.model} is tagged as such."
end

def update(_repo, meta, _fields, _filter, _autogen, [_|_] = returning, _opts) do
raise ArgumentError,
"MongoDB adapter does not support :read_after_writes in models. " <>
"The following fields in #{inspect meta.model} are tagged as such: #{inspect returning}"
end

def update(repo, meta, fields, filter, {pk, :binary_id, _value}, [], opts) do
normalized = NormalizedQuery.update(meta, fields, filter, pk)

Connection.update(repo, normalized, opts)
end

def update(repo, meta, fields, filter, nil, [], opts) do
normalized = NormalizedQuery.update(meta, fields, filter, nil)

Connection.update(repo, normalized, opts)
end

@doc false
def delete(repo, meta, filter, opts) do
Expand Down