Gorm: support for MongoDB connection

Created on 30 Jan 2018  路  2Comments  路  Source: go-gorm/gorm

Hi, i'm interested with GORM library and i intend to implement it in my project, but, for my Database, i use MongoDB from https://labix.org/mgo which not supported by Gorm. I read in this website: http://jinzhu.me/gorm/database.html#connecting-to-a-database
and i see that i must create new dialect for unsupported database, but i have no idea what i must rewrite for the new dialect.go for mongoDB connection. Can you give some guidance to connect for Mgo?

Most helpful comment

Gorm supports SQL relational databases. Gorm is an abstraction layer over SQL.

MongoDB is a noSQL database that has its own query language based on javascript.

Gorm is thus not the appropriate tool for your use case. Investigate Go MongoDB ORM packages instead.

All 2 comments

Gorm supports SQL relational databases. Gorm is an abstraction layer over SQL.

MongoDB is a noSQL database that has its own query language based on javascript.

Gorm is thus not the appropriate tool for your use case. Investigate Go MongoDB ORM packages instead.

Perhaps another solutino could be simply to write another layer of abstraction which itself abstracts both, the SQL and NoSQL databases by abstracting the differences over the Gorm and the Mongo stuff, and as a result, @calvinsug can have his cake and eat it too...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sredxny picture sredxny  路  3Comments

koalacxr picture koalacxr  路  3Comments

littletwolee picture littletwolee  路  3Comments

pjebs picture pjebs  路  3Comments

alanyuen picture alanyuen  路  3Comments