Why is PyMongo 3 giving ServerSelectionTimeoutError?

后端 未结 20 1076
我在风中等你
我在风中等你 2020-11-30 01:21

I\'m using:

  • Python 3.4.2
  • PyMongo 3.0.2
  • mongolab running mongod 2.6.9
  • uWSGI 2.0.10
  • CherryPy 3.7.0
  • nginx 1.6.2
20条回答
  •  [愿得一人]
    2020-11-30 02:18

    • First set up the MongoDB environment.

    • Run this on CMD - "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe"

    • Open another CMD and run this - "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"

    And then you can use pymongo [anaconda prompt]

    import pymongo
    from pymongo import MongoClient
    
    client = MongoClient()
    db = client.test_db
    collection = db['test_coll']
    

    Refer - https://docs.mongodb.com/tutorials/install-mongodb-on-windows/

提交回复
热议问题