We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey!
I have a weird bug in my production application which I was able to reproduce in the repo with the latest master in test/mongo_ecto_test.exs:
master
test/mongo_ecto_test.exs
test "where in ids + dynamic limit + dynamic offset" do post1 = TestRepo.insert!(%Post{}) post2 = TestRepo.insert!(%Post{}) ids = [post1.id, post2.id] limit = 1 offset = 1 query = from p in Post, where: p.id in ^ids, limit: ^limit, offset: ^offset assert TestRepo.all(query) == [post2] end
p.id in ^ids
limit: ^limit
ids
** (ArithmeticError) bad argument in arithmetic expression code: assert TestRepo.all(query) == [post2] stacktrace: :erlang.-(#BSON.ObjectId<5c40b5cdac013d9153aefc9f>, 1) (mongodb) lib/mongo/cursor.ex:106: Enumerable.Mongo.Cursor.new_limit/2 (mongodb) lib/mongo/cursor.ex:44: anonymous fn/6 in Enumerable.Mongo.Cursor.start_fun/6 (elixir) lib/stream.ex:1362: anonymous fn/5 in Stream.resource/3 (elixir) lib/enum.ex:2979: Enum.map_reduce/3 (mongodb_ecto) lib/mongo_ecto.ex:600: Mongo.Ecto.execute/6 (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5 (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4 test/mongo_ecto_test.exs:104: (test)
offset: ^offset
12:05:34.821 [error] GenServer #PID<0.295.0> terminating ** (DBConnection.ConnectionError) client #PID<0.309.0> stopped: ** (ArgumentError) argument error (mongodb) lib/mongo/messages.ex:116: Mongo.Messages.encode_op/1 (mongodb) lib/mongo/messages.ex:59: Mongo.Messages.encode/2 (mongodb) lib/mongo/protocol/utils.ex:32: Mongo.Protocol.Utils.send/3 (mongodb) lib/mongo/protocol/utils.ex:12: Mongo.Protocol.Utils.message/3 (mongodb) lib/mongo/protocol.ex:273: Mongo.Protocol.message_reply/2 (mongodb) lib/mongo/protocol.ex:186: Mongo.Protocol.handle_execute/4 (db_connection) lib/db_connection.ex:958: DBConnection.handle/4 (db_connection) lib/db_connection.ex:1100: anonymous fn/4 in DBConnection.run_execute/4 (db_connection) lib/db_connection.ex:1142: anonymous fn/4 in DBConnection.run_meter/5 (db_connection) lib/db_connection.ex:1199: DBConnection.run_begin/3 (db_connection) lib/db_connection.ex:636: DBConnection.execute/4 (mongodb) lib/mongo.ex:414: Mongo.raw_find/5 (mongodb) lib/mongo/cursor.ex:40: anonymous fn/6 in Enumerable.Mongo.Cursor.start_fun/6 (elixir) lib/stream.ex:1362: anonymous fn/5 in Stream.resource/3 (elixir) lib/enum.ex:2979: Enum.map_reduce/3 (mongodb_ecto) lib/mongo_ecto.ex:600: Mongo.Ecto.execute/6 (ecto) lib/ecto/repo/queryable.ex:130: Ecto.Repo.Queryable.execute/5 (ecto) lib/ecto/repo/queryable.ex:35: Ecto.Repo.Queryable.all/4 test/mongo_ecto_test.exs:105: Mongo.EctoTest."test where in + limit"/1 (ex_unit) lib/ex_unit/runner.ex:312: ExUnit.Runner.exec_test/1 (db_connection) lib/db_connection/connection.ex:243: DBConnection.Connection.handle_cast/2 (connection) lib/connection.ex:810: Connection.handle_async/3 (stdlib) gen_server.erl:637: :gen_server.try_dispatch/4 (stdlib) gen_server.erl:711: :gen_server.handle_msg/6 (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
The text was updated successfully, but these errors were encountered:
Fix finding values for limit and offset with where arrays, close elix…
390aab9
…ir-mongo#170
Opened this PR to address the issue #171.
Sorry, something went wrong.
b1bd163
No branches or pull requests
Hey!
I have a weird bug in my production application which I was able to reproduce in the repo with the latest
master
intest/mongo_ecto_test.exs
:p.id in ^ids
withlimit: ^limit
, it fails with the following error (the id fromids
is somehow used as a count):p.id in ^ids
withoffset: ^offset
, it fails with another error:The text was updated successfully, but these errors were encountered: