-
Notifications
You must be signed in to change notification settings - Fork 127
Please improve README documentation for 2.0.0 #196
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
Comments
@sriedel I can't thank you enough for all this! These are excellent points. We'll try to get these fixed. /cc @mweidner037 |
@mweidner037 I think this might be necessary changes for a 2.0 release. What do you think? |
It would be easier to add to release 2.1, to avoid cross-wiring our git history. Or, we cancel #199 and use the current master as 2.0 - the disadvantage being that then 2.0 will not work with Ecto versions < 3.12 (#198). |
@sriedel Regarding ecto commands (e.g. config :ecto_mongodb_test, MyRepo,
database: "ecto_mongodb_test_my_repo",
hostname: "localhost", and one for the application as whole: config :ecto_mongodb_test,
ecto_repos: [MyRepo] I am not too familiar with ecto commands, but that setup is what works in our codebase. |
@mweidner037 Could we fix up the readme in |
I believe this is covered in the full module docs (https://hexdocs.pm/mongodb_ecto/Mongo.Ecto.html#module-indexes-and-migrations), though I do not know how up-to-date that is. I will add a link to the bottom of the readme so that it is clear there is more info elsewhere. |
Yes, that should be fine. |
Background
As a relative newbie to elixir and ecto, I've just tried setting up my first project to test ecto and mongodb. While setting up the project I've had a look at both Ectos "Getting Started" documentation on hex.pm and the Readme in the master branch of this project. I've chosen to use mongodb_ecto 2.0.0-rc.1, since I'm starting fresh anyway. :)
So the following is from the perspective of someone who isn't steeped in background knowledge of the individual libraries and is just trying to get something up and running.
This is with a freshly created project using elixir 1.17.3.
Typo
Small typo in the "Example" Section - the password should probably be
mongodb
notmongosb
Repo configuration
Then the "Example" section states
while "Usage" states
Turns out,
adapter
is required, otherwise a compile error is thrown (** (ArgumentError) missing :adapter option on use Ecto.Repo
)Model Configuration
The example section contains a
use Ecto.Model
while ecto itself seems to useuse Ecto.Schema
. Not sure what the differences are, I'm assumingEcto.Model
is a past implementation and nowadaysEcto.Schema
is the thing to use?Also, it should be pointed out that the
@primary_key {:id, :binary_id, autogenerate: true}
is important, otherwise one will get a** (RuntimeError) MongoDB adapter does not support
:idtype as primary key
when trying to persist a document.mix.exs:
applications
orextra_applications
?The "Usage" section states that
ecto
andmongodb_ecto
should be added to theapplications
configuration, next to logger. Howevermix
created the configuration withlogger
inextra_applications
. Is this whereecto
andmongodb_ecto
should be placed, or isapplications
the correct place? Does one need to go in one, and the other in the other? Not sure. I've put both inextra_applications
, and it seems to work (in iex at least).mix ecto.create
Using the
config
example in the "Example" section,mix ecto.create
saidI had created
MyRepo
withmix ecto.gen.repo
with the-r
option, so that was confusing at first.Changing the config section to look as follows:
did not fix the error, however. I actually needed to remove the
MyRepo
reference formix ecto.create
to be happy:However, trying to start
iex -S mix
now floods my terminal with the message:which was confusing, as the
:database
key was in the config section. Adding it to theuse Ecto.Repo
declaration inMyRepo
didn't fix it. I did need to re-add theMyRepo
to the config section to fix this:Now
iex -S mix
starts up and I can interact with mongodb. So it seems I can either issue database queries or interact withmix ecto
commands, but not both without changing theconfig
? This doesn't feel right :).mix mongo.migrate
Some mongo mix tasks are added, but are not mentioned in the Readme, while the ecto documentation uses examples of
mix ecto.gen.migration
, which seems to be completely missing.I realize that these mix tasks are probably database specific, a pointer to the
mongodb_driver
s documentation of migrations would be helpful, just to know what format the migrations need to be in.Dependency update to
mongodb_driver
1.5.0?mongodb_driver 1.5.0 was released in September, while the release candidate is stuck on
~> 1.4.0
. This seems to have been fixed - could an rc.3 version be released that includes this fix?decimal
dependenciesI made the mistake of first adding
:ecto
as a dependency(without
mongodb_ecto
), runningmix deps.get
, then addingmongodb_ecto
and then encountering a versioning issue withdecimal
. The initialmix deps.get
locked the version to2.3.0
which is incompatible withmongodb_driver
s requirement of~> 2.1.1
.It took me a while to realize that the solution was to:
which fixed the issue. Typical newbie trouble, and not immediateely related to this project. But I thought I'd mention it, since some other newbie may hit that snag and giving the solution here will help them.
[Edit: fixed
decimal
dependency name]The text was updated successfully, but these errors were encountered: