The problem was on the "go.mongodb.org/mongo-driver/v2/mongo" package after i change to "go.mongodb.org/mongo-driver/mongo" package the decoding method worked just fine. So we have to use the mongoClient on the "go.mongodb.org/mongo-driver/mongo" package