I am developing a website. Postgres or Mongodb?(see description for idea)

I have an idea of a website.It will be like an online startup social network where people can discuss, submit links,review these startups.

New startups will also get to features themselves and present to people. we will have many metrics for these startups like buzz , potential etc. users will also have reputations based on upvotes/downvotes they receive on their comments/reviews/links.

I have decided to use Golang for this application.
I am asking for advice on which database to use MongoDB or Postgres or something else as I am very confused from various articles on the internet.

Also it will be helpful if got any advice for the Go part of the application.Thank you!suggestions are welcome!

Can you elaborate why you’re already determined to use Go?
I don’t know much about it, but you’ll have to look at how to run and deploy such applications, and whether or not Go integrates well for your chosen database.

What are your requirements for the database?
Do you need real-time search, reactivity?
Are JSON documents better for you than relational tables?
How do you want to host it?
How do you plan to scale your app?

My point being: Your choice of tools has to depend on what features and properties your project really requires. Don’t make the mistake of choosing your tools first and then try to make them fit your requirements.

3 Likes

I would go with Mongo, relational databases can give you a lot of trouble sometimes, plus Mongo queries are dead simple.

For the go part, I would not use any framework for it, go with http/net, json and the famous router (I forgot it’s name).

Good luck!

1 Like

Congratulations on using Go! It’s my favorite language. As noted above, don’t jump into a web framework. Just use the standard library to start. You may end up using some additional packages, but make sure you select just what you need – like maybe sessions or websockets. Do not use a whole framework, since it will unnecessarily complicate your codebase.

Which database to use depends on the shape of your data. Start writing it with unit tests, and mock the database backend with some kind of interface. As you go along, it will become clear what you need. If you need lots of joins then you probably want Postgres. Also, PostgreSQL has had a lot of new features added in over the past five years. You may find that it’ll handle all of what you want – storing JSON, handling data from external sources, and more.

1 Like

I like both options, but i am digging the power and flexability of mongo lately. If it were me, mongo but it is your call.

1 Like

I have learned how to develop web apps with Go. I have a background in c++ so it was very easy learning
Go. For the database part Go very well interacts with almost all databases through drivers.they also have ORM packages for SQL databases .i will host it on digital ocean .Deployment is very easy JUST ONE BINARY and some tweaking for demonizing it. Also Go has vast support of packages for caching, sessions , cookies , OAUTH 2 etc.

1 Like

maybe you are talking about Gorilla Mux.

thank you. I too tried learning some frameworks but they kind of enforce things on you . and i hate that. i have chosen to use packages (the Go way). I just want to ask Would JSON be a good choice rather than relational databases ?

You can go with MongoDB… It will be more suitable with your requirements