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

Compatibility changes to support mongodb_ecto adapter #227

Merged
merged 8 commits into from
Jan 13, 2024

Conversation

brennana
Copy link
Contributor

@brennana brennana commented Jan 9, 2024

The mongodb_ecto package wishes to switch its underlying driver to this one, since it has better support for current MongoDB versions. However, a series of changes are required to support the adapter.

Some BSON encoders and a missing generic update function were added for the adapter. Plus, a small option fix for the do_log function in mongo.ex.

Most notably, the find-then-modify command functions find_one_and_update and find_one_and_replace now return appropriate FindAndModifyResult structs that contain additional write information otherwise neglected, which the adapter requires. This is also consistent with the other existing mutative command functions that already return respective result structs.

brennana and others added 8 commits June 27, 2023 14:53
…e same name

The application env variable called `log` is meant to be either a boolean or atom log level, whereas the function option called `log` is potentially a function or MFA tuple that is passed down to DBConnection.
This function is copied from the older `mongodb` driver for compatibility with the ecto adapter
@zookzook
Copy link
Owner

Thanks for the PR. I will take a look at it as soon as possible. Maybe at the weekend.

@zookzook zookzook self-assigned this Jan 10, 2024
@zookzook zookzook merged commit 7ffb885 into zookzook:master Jan 13, 2024
3 checks passed
@zookzook
Copy link
Owner

Thank you. I need to draft a new release, but this will break the API a bit because the find_and_modify function now returns the FindAndModifyResult.

LKlemens pushed a commit to LKlemens/elixir-mongodb-driver that referenced this pull request Feb 2, 2024
* Add BSON encoders for Elixir Date/NaiveDateTime

* Return FindAndModifyResult struct from appropriate operations

* Fix conflation of application `log` env var and function option of the same name

The application env variable called `log` is meant to be either a boolean or atom log level, whereas the function option called `log` is potentially a function or MFA tuple that is passed down to DBConnection.

* Add generic Mongo.update/4 function

This function is copied from the older `mongodb` driver for compatibility with the ecto adapter

* Update tests for functions returning FindAndModifyResult

* Mix format

* Update array_filters test for FindAndModifyResult structs
@zookzook
Copy link
Owner

I released a new version 1.4.0 (https://hex.pm/packages/mongodb_driver)!

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

Successfully merging this pull request may close these issues.

2 participants