I'm having the next issue.. I can't get all records from my mongo database (running in a docker containner), here is my really simple code:
type User struct {
Email string `json:"email" bson:"email"`
Pass string `json:"pass" bson:"pass"`
}
session := dbConnect()
collection := session.DB("my_db").C("users")
var users []User
err := collection.Find(nil).All(&users)
if err != nil {
log.Fatal("Mongo collection find fail: ", err)
}
fmt.Println("Results >> ", err)
The thing is "err" returns <nil>
. Something weird is that inserting documents on the database actually works. Thank you!