chaitanya

chaitanya

Using MongoDB as database for phoenix app 1.4

Hello,
I am very new to Phoenix. I am trying to develop an app with Mongodb as database. i have now installed latest version of Phoenix i.e. 1.4. I believe this is a very basic question to ask, but kindly bear with it.
I have searched for a solution to use mongodb and found few links which are kind of bits and pieces and i was not sure to which version of Phoenix they refer to. So here are my questions.

  1. While using mongodb with phoenix 1.4, do we need Ecto? (I tried to create new project with “mix phx.new hello --database mongodb”, but it failed to recognize mongodb. only options available are postgres, mysql, mssql).
    – as i have read in an article that mongodb driver can be used. so not sure if ecto is reqiured.
  2. is there any link which can walk through the entire process of creating a new project with mongodb.

Thanks for taking time in reading my question.

Most Liked

peerreynders

peerreynders

I believe this is a very basic question to ask

Not as basic as you may think as MongoDB isn’t as popular as it is in other communities.

Hex: mongodb, mongodb_ecto

Have you looked at

yet?

  • For learning Phoenix it might be easier to simply stick to the default PostgreSQL setup.
  • If you need to use MongoDB it may make more sense to get your bearings with plain Elixir first before you try to use it in Phoenix (How to use MongoDB With Elixir - Revisited (2016)).

It has been done … but pretty much expect this attitude:


CRUD

Ankhers

Ankhers

No you do not. The mongo ecto adapter has not had work done on it for a little while. With the release of Ecto 3.0, I was going to try and get it updated, but have not yet found the time.

Not that I am aware of. Just add the mongodb package to your deps list. The documentation (linked by @peerreynders) shows the basics of using it. If you have any questions or concerns, feel free to PM me here, on the Elixir slack or on IRC.

mkunikow

mkunikow

ehhh No SQL, No SQL is passe. Now is New SQL :slight_smile:
SQL → NO SQL → and here we back again to SQL or rather New SQL (like google spanner, or crouch db)

Also Redhat ditched Mongo DB for PostgreSQL after Mongo DB changes licence :slight_smile:

MongoDB changed licence when AWS was hosting own MongoDB without any contribute back to MongoDB :slight_smile:. After MongoDB changed licence AWS screw MongoDB again creating theirs own version of MongoDB called documentdb Amazon DocumentDB- Serverless, fully managed, MongoDB API-compatible document database
https://www.awsgeek.com/posts/Amazon-DocumentDB/

So MongoDB is screwed now :smiley: as open source database.

Last Post!

AstonJ

AstonJ

A post was split to a new topic: Bongo - A simple odm for mongodb written in elixir

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31494 112
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40042 209
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement