因为在PyCharm中调用MongoDB数据库时没有启动本地的MongoDB服务引起。
出现‘ [initandlisten] waiting for connections on port 27017’提示说明服务器已经启动成功 接着重新运行代码就可