def __init__( self, database='proauth2', host='localhost', port=27017,
                  user=None, pwd=None ):
        '''
        initialize a mongodb connection to mongodb://user:pass@host:port
        use database
        '''
        if user and pwd:
            connection_string = 'mongodb://%s:%s@%s:%s' \
            % ( user, pwd, host, port )
            self.db = MongoClient( connection_string )[database]
        else:
            self.db = MongoClient( host, port )[database]
def __init__ ( self , database = 'proauth2' , host = 'localhost' , port = 27017 , user = None , pwd = None ) : if user and pwd : connection_string = 'mongodb://%s:%s@%s:%s' % ( user , pwd , host , port ) self . db = MongoClient ( connection_string ) [ database ] else : self . db = MongoClient ( host , port ) [ database ]
initialize a mongodb connection to mongodb://user:pass@host:port
        use database