-
Notifications
You must be signed in to change notification settings - Fork 124
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
[WIP] Support for Ecto 2.0 #91
Conversation
fix update_all and insert_all tests
For anyone that is following along, I have to make a couple changes in the |
* Mongo does not support returning * Mongo does not support joins * Mongo does not support composite keys
Awesome! Do you need more help? Seems there still are a lot to do. |
I would appreciate any help you or anyone else could provide. I currently After that, just try and leave a message here with what you are working on On Aug 21, 2016 10:46, "hartator" notifications@github.com wrote:
|
Sure, will be glad to find some time to help. |
Changes Unknown when pulling b5853b8 on ankhers:ecto-2 into * on michalmuskala:ecto-2*. |
Mongo wants you to be explicit about not wanting the ID field returned
Changes Unknown when pulling c2c2144 on ankhers:ecto-2 into * on michalmuskala:ecto-2*. |
Changes Unknown when pulling eeb0da0 on ankhers:ecto-2 into * on michalmuskala:ecto-2*. |
@ankhers I'm very happy to take logging as I just ran into an issue with it and started to fix! |
@cjbell That would be awesome! I also ran into the logging issue today. |
@scottmessinger if you need something working right now, you can point to this branch (which is a fork of @ankhers |
You can also configure your repository with |
Thanks for the super quick response! I added in the log: false, and that did the trick. The error isn't reported, and all the data passed through to the table as I had hoped (very quickly, too.) |
@AlexKovalevych Thanks - I'll give that a shot too. Thanks for the reply, its much appreciated. |
Fix logging
Just as a quick update to everyone, it appears that the only remaining test to fix is the JavaScript test. If someone has any argument(s) for fixing the tests that I have decided to not fix (you can see the entire list in the PR description) please let me know. If you change my mind, or provide a PR, I will gladly attempt to fix it. |
That's an awesome news. I'll review the code over this week (or weekend). I'll also do appropriate changes to ecto to make it possible to isolate the tests that require features MongoDB does not provide. Thank you, @ankhers for all the work you did here. |
As it turns out, I'm not entirely sure about making the javascript test pass. Is this something that people are even interested in using? |
@ankhers I never use javascript in my mongo queries as it can't make use of any indexes, so for me, the lack of |
Seems here wrong search, when we searching by map. For example: Repo.get_by(Some, map_field: %{}) It will search with |
I have added spec for this case: Seems it is more Mongo/MongoDB behavior. |
@merqlove I do not think that is an issue. I was able to insert and query properly based on map input.
|
@merqlove Can you show a failing test with This is not mongodb behaviour: iex(1)> %{foo: %{}} |> BSON.encode |> BSON.decode
%{"foo" => %{}}
iex(2)> %{foo: []} |> BSON.encode |> BSON.decode
%{"foo" => []} |
It is possible that the adapter translates maps to keyword lists. If it does that it should not do it for empty maps. |
@ericmj @ankhers This is not critical moment, but better to have maps more predictable. |
Okay. When I showed this as working, I didn't realize but the project was using an older commit. This appears to be a regression. I will take a look at where this broke. |
I found the problem (It is the most recent commit). So I should be able to basically revert it and things should work as expected. But I would prefer to just not convert the empty map into an empty list. |
@ankhers great!
|
@merqlove Just so you know, I have fixed that issue. Though, going forward, you may want to switch to the official ecto-2 branch (that is where this fix is). |
Excellent, thanks! |
@AlexKovalevych Any chance you could post some of your code to get the pipeline working? I added it in, and it doesn't toss any errors, but doesn't appear to log any request to Mongo at all. |
@justmark do you have debug logs? because i have no problem with it (as it was before upgrade). |
@justmark if you mean aggregation pipeline, then it doesn't log those i think, since i use mongo driver directly, ecto has nothing to do with it. Aggregation example: Mongo.aggregate(YourRepo.__mongo_pool__, collection_name, [%{"$match" => ..}, %{"$group" => ..}]) |
@AlexKovalevych Thanks - I've got:
but that results in an error:
I also tried using your "mongo_pool" suggestion, but that also generated an error:
|
@justmark Seems you have wrong pipeline. |
@merqlove Hi, I saw in your query that you used "Repo.Pool". I used this instead of what I had previously (Svr.Repo.pool) and your change worked. Thanks! |
Just copying the list from #84
This is a list of the remaining tests that need to pass before the Ecto 2.0 cut can be made.
This is a list of tests that will not be fixed and why.
null
(or no value) to be the same across a unique index.null
(or no value) to be the same across a unique index.^"a" in ^["a", "b", "c"]
does not translate well into Mongo.