Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1516

Not able to connect to Cloud MongoDB Mlab saying connection refused

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.4
    • Component/s: Internal
    • None

      Hello

      I'm trying to connect to mlab cloud mongo db using python 2.7.10

      I have install the requried libraries. However when excuted the code below its saying connection refused.
      --------------------My Python Code Below----------------------------

      from flask import Flask
      from flask_pymongo import PyMongo
      
      app = Flask(__name__)
      
      app.config['MONGO_DBNAME'] = 'pymongologindb'
      app.config['MONGO_URL'] = 'mongodb://xxxxx:yyyyyy@ds255958.mlab.com:55958/pymongologindb'
      
      mongo=PyMongo(app)
      
      @app.route('/add')
      def add():
          user=mongo.db.users
          user.insert({'name':'Atul'})
          return 'Added User
      
      if __name__ == '__main__':
          app.run(debug=True)
      

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            atultupe Atul Tupe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: