0

I am trying to use buffalo framework (Golang) with Mongodb Database as database.yml file as follows:

development: database: myproject_development user: mongodb password: mongodb host: 127.0.0.1 url: mongodb://127.0.0.1:27017

test: url: {{envOr "TEST_DATABASE_URL" "mongodb://mongodb:mongodb@127.0.0.1:27017"}}

production: url: {{envOr "DATABASE_URL" "mongodb://mongodb:mongodb@127.0.0.1:27017"}}

But getting error as

Error:

level=error msg="Error: unknown dialect "mongodb" expecting one of cockroach, mariadb, mysql, postgres"

Additional: And if you can add some links for the learning purpose of the same integration ,will be very helpful. Thanks in advance .

  • 1
    I think the error is pretty clear: only a handful of relational databases are supported, MongoDB isn't one of them, MongoDB isn't even a relational database. See: [How to use GORM for Mongodb in Golang?](https://stackoverflow.com/questions/63539258/how-to-use-gorm-for-mongodb-in-golang/63541161#63541161) For integration see their official docs https://gobuffalo.io/en/docs/db/configuration/ – icza Feb 17 '22 at 10:52
  • 1
    Buffalo can be configured to operate without the buffalo-pop plugin, which is what you are trying here to use. From the cli, use the flag --skip-pop when creating a new project. For an existing project, remove all the code related to pop middleware. At that point you can write your own code to manage the Mongo DB connection, fetching data and storing data. Buffalo doesn't have anything to help you with this, but it won't block you. MongoDB has info about getting started with the driver: https://www.mongodb.com/languages/golang, as an alternative to GORM. – Brian Wagner Feb 22 '22 at 04:34
  • any example application where i can relate this concept will be very helpful .Plz provide link for the same . Thanks in advance . – gargi sharma Feb 22 '22 at 05:49

0 Answers0