-2

I am using Golang as backed language with mongodb database and also new to this language.I have used both libraries "gopkg.in/mgo.v2" and "go.mongodb.org/mongo-driver/mongo" to perform all CRUD oprations. My Question is which one is more efficient to use according to all parameters like lightweight,performance,execution time etc.?

icza
  • 389,944
  • 63
  • 907
  • 827
Rajandeep Kaur
  • 185
  • 1
  • 9

1 Answers1

2

I don't think it should be a question of efficiency. mgo has long gone unmaintained and does not support new features of new versions of MongoDB (such as ACID transactions), while the other is the official driver with regular updates. Use the official driver.

Both drivers execute basic operations nearly at same speed. Run benchmarks if you need exact figures, but again, there are more to consider than just "raw" speed.

icza
  • 389,944
  • 63
  • 907
  • 827
  • Also, to add - In most cases, the driver/library used to connect to the database will not have any non-negligible impact on the performace as compared to the database performance itself. – Ayush Gupta Jul 27 '20 at 10:16