每当我为mongo数据库创建索引时都会收到错误

时间:2019-04-15 19:19:37

标签: python-3.x mongodb pymongo robo3t

我已经使用命令propt为Mongodb创建了索引,但是收到错误消息。这段代码来自python shell

>>> import pymongo
>>> from pymongo import MongoClient 
>>> myClient = MongoClient
>>> myClient = MongoClient()
>>> db = myClient.mydb
>>> users = db.users
>>> db.users.create_index([("username", pymongo.ASCENDING)])

pymongo.errors.ServerSelectionTimeoutError: localhost:27017:     [WinError   10061] No connection could be made because the target machine actively refused it

0 个答案:

没有答案