Can not connect to MongoLab...

Issue #2 resolved
Former user created an issue

I am trying to use this module and I am unable to connect. Also, I am not sure how to view the DEBUG messages in cmonary.c.

I have tried with the 'with' statement as well as through the interpreter.

import monary m = monary.Monary("ds######.mongolab.com", 33828) print m._connection None

I also want to authenticate, so this is what I was hoping to use (or something like it).

with monary.Monary(db_host, db_port) as m: success = m.authenticate(db_name, db_user, db_pass) if success: arrays = m.query( db_name,
"my_collection",
spec,
fields, types
)

I have no problem connecting with pymongo btw.

This works: db = pymongo.Connection(db_host, db_port)[db_name] db.authenticate(db_user, db_pass)

Thanks,

Will

Comments (4)

  1. swill NA

    The formatting of the python code is ugly in the above. Here it is better...

    >>> import monary
    >>> m = monary.Monary("ds######.mongolab.com", 33828)
    >>> print m._connection
    None
    
    with monary.Monary(db_host, db_port) as m:
        success = m.authenticate(db_name, db_user, db_pass)
        if success:
            arrays = m.query(
                db_name,                        
                "collection",                  
                spec,                             
                fields, 
                types                
            )
    

    This works with pymongo...

    db = pymongo.Connection(db_host, db_port)[db_name]
    db.authenticate(db_user, db_pass)
    
  2. A. Jesse Jiryu Davis

    The latest Monary code has no more "authenticate()" method, we now include auth credentials in the URI, like:

    Monary("mongodb://user:password@host/database_name/")

    I'm going to close this issue, feel free to re-open if you still experience an issue.

  3. Log in to comment