mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Cannot connect to database default : False is not a read preference.

Open nekoctl opened this issue 11 years ago • 38 comments

I use connect(host='mongodb://username:password@localhost:port/database') in my django settings.py. Run server then got a report:

mongoengine.connection.ConnectionError: Cannot connect to database default :
False is not a read preference.

Is this a bug or not? Write in python 3.4.3 with django 1.8 and mongoengine 0.9.0

nekoctl avatar Apr 09 '15 11:04 nekoctl

Same problem is described on SO. It looks like mongoengine has some issues with the newest version 3.0 of pymongo released just two days ago. Easiest workaround - revert from version 3.0 to 2.8.

mseimys avatar Apr 09 '15 11:04 mseimys

@mseimys Thanks

nekoctl avatar Apr 09 '15 11:04 nekoctl

No problem. Anyway, I wouldn't close this issue just yet - problem is still there, i haven't got enough skills yet to fix it :)

mseimys avatar Apr 09 '15 11:04 mseimys

With the progress of refer to: #935 I find it.

nekoctl avatar Apr 09 '15 11:04 nekoctl

Got the same problem, i guess Closed is not meant to, as the issue is still present.

tito avatar May 28 '15 23:05 tito

Got the same problem +1

orionCMCMSU avatar May 29 '15 14:05 orionCMCMSU

+1

trbck avatar Jun 01 '15 23:06 trbck

+1

hamzawaqas-10p avatar Jun 03 '15 09:06 hamzawaqas-10p

It is fixed in master, so just use mongoengine master (and wait for next release) or use pymongo==2.8. Adding +1 will not help here :)

MRigal avatar Jun 03 '15 11:06 MRigal

I already got it working with 2.8 :P so its not just the matter of +1 ;) @MRigal

hamzawaqas-10p avatar Jun 03 '15 12:06 hamzawaqas-10p

+1, please how can I downgrade?

lukaspetr avatar Jun 04 '15 09:06 lukaspetr

@lukaspetr Add pymongo==2.8.1 in your requirements.txt

hamzawaqas-10p avatar Jun 04 '15 09:06 hamzawaqas-10p

@hamzawaqas-10p thank you. It was also necessary to change the setting to install_requires=['pymongo==2.8.1'], in mongoengine's setup.py

lukaspetr avatar Jun 04 '15 11:06 lukaspetr

Will this problem be fixed in the next version?

lukaspetr avatar Jun 04 '15 11:06 lukaspetr

Since it is in master, for sure :-)

2015-06-04 13:49 GMT+02:00 Petr Lukas [email protected]:

Will this problem be fixed in the next version?

— Reply to this email directly or view it on GitHub https://github.com/MongoEngine/mongoengine/issues/950#issuecomment-108857109 .

MRigal avatar Jun 04 '15 12:06 MRigal

@MRigal thank you for the piece of information!

lukaspetr avatar Jun 04 '15 12:06 lukaspetr

Looks like @MRigal fixed it, thank you!

nekoctl avatar Jun 04 '15 15:06 nekoctl

+1

matheusho avatar Jun 16 '15 14:06 matheusho

+1

hamidfzm avatar Jun 23 '15 05:06 hamidfzm

2.8 it workd!

sit-in avatar Oct 11 '15 09:10 sit-in