Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1236

Get mLab Client Authentication Fails

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Gone away
    • Icon: Major - P3 Major - P3
    • None
    • 1.1.0
    • None
    • None
    • Mac OSX

    Description

      Connecting to a client works fine:

      var MongoURI = "mongodb://usermanagement:Jn4LEWxPBuqynRTjz7qd@ds159273.mlab.com:59273/goautoauto-usermanagement"
      var client *mongo.Client
      // creates an empty option
      opt := options.Client()
      opt.ApplyURI(MongoURI)
      client, err := mongo.NewClient(opt)
      if err != nil {
         ...
      }
      

      In this case I am able to get a client with no error, and connect with no error using the `client.Connect(ctx)` method.

       

      The problem comes when I attempt to do a simple count operation:

      n, err = c.client.Database(database).Collection(userCollection).CountDocuments(context.Background(), bson.M{})
      

      In this case, I get the error:

      error counting documents in user collection: (Unauthorized) not authorized on
      

      I am sure that the user/pass used in the URI are correct, as I used the same text when connecting with the Mongo shell (on the shell I do not get any unauthorized errors). 

      Attachments

        Activity

          People

            kris.brandow@mongodb.com Kristofer Brandow (Inactive)
            shishir.jakati98@gmail.com Shishir Jakati
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: