Skip to content
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

happy to help get mongodb_ecto to work more easily. #248

Open
cortfritz opened this issue Jul 24, 2024 · 4 comments
Open

happy to help get mongodb_ecto to work more easily. #248

cortfritz opened this issue Jul 24, 2024 · 4 comments

Comments

@cortfritz
Copy link

I can't get this to work and am probably missing something obvious.

I haven't gotten beyond this issue: mongodb_ecto seems to expect Mongo.Query struct to have the key :extra.

If I could get this working I would love to submit PRs for explicit instructions in README or additional md file, and submit an example in examples/mongo_ecto.ex.

If :mongodb_driver needs to be updated to add this key to the query I'm also happy to submit that PR, and any insight into what :extra is doing would be appreciated.

@zookzook
Copy link
Owner

zookzook commented Aug 9, 2024

I think there is no reason to change anything here. You need to check this PR: elixir-mongo/mongodb_ecto#190

@cortfritz
Copy link
Author

Thank you zz.

Was extra: coll and subsequent references to coll vestigal or unused? The PR removes it from the Query struct and comments out lines where it's referenced. Maybe coll is already assumed in the context of a query. Maybe extra allowed for an override of that? I'm trying to figure out what might now be incompatible with this change.

@brennana
Copy link
Contributor

@cortfritz Yes, the extra: coll was a remnant from the deprecated-and-removed mongo query commands. The new command structure, required by 6.0+, includes collections in the command log lines via the subcommand portion of the command. For example, the new commands now look like:

COMMAND [find: "my_collection", filter: [_id: #BSON.ObjectId<5cabe2398fbb653f09ffaf82>], projection: %{_id: true, created_at: true}, "$readPreference": %{mode: :primary}] []

where find: "my_collection" identifies the collection under the find subcommand. Aggregations and other collection commands work the same way.

The mongodb_ecto driver, as of the aforementioned PR#190, no longer expects the extra field in order to support MongoDB 6.0+, and the newer commands.

@scottmessinger
Copy link
Contributor

@cortfritz We just merged in the change so the Elixir Ecto driver (rc.2) now works with this driver. We've had it in production and haven't had any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants