Mongoengine: database names cannot contain the character '.'

Created on 2 Jan 2018  路  5Comments  路  Source: MongoEngine/mongoengine

I am trying to insert document using mongoengine but it raises an exception:

(<class 'pymongo.errors.InvalidName'>, InvalidName("database names cannot contain the character '.'",), <traceback object at 0x000000000844F708>)

Connection string is mongodb://user:[email protected]:42487/db-name

Any suggestion how to fix this??

Thanks

Most helpful comment

Rather than using
connect("mongodb://user:[email protected]:42487/db-name")
use this
connect( db='db-name', username='user', password='pass', host='mongodb://user:[email protected]:42487/db-name' )

It worked for me. :)

All 5 comments

did u use connect method like this?
connect("mongodb://user:[email protected]:42487/db-name")

yes.
Can you please suggest me the right way if I am doing something wrong?
@erdenezul
Thanks

Rather than using
connect("mongodb://user:[email protected]:42487/db-name")
use this
connect( db='db-name', username='user', password='pass', host='mongodb://user:[email protected]:42487/db-name' )

It worked for me. :)

connect(db='db-name', username='user', password='pass', host=ds042487-a0.mlab.com, port=42487) should work also

just try to install dnspython package it resolve the issue

Was this page helpful?
0 / 5 - 0 ratings