王博不是王博士 2019-05-22 10:45 采纳率: 0%
浏览 3811

pycharm连接上mongoDB数据库,但是无法可视化查看数据库中的内容

1安装mongoDB,配置成功
2在pycharm上配置连接成功,也能够查看到数据库,及数据库中存储内容的大小,
!!!!!
但是无法可视化查看数据库存储的具体内容

图片说明

图片说明

import requests
import json
from bs4 import BeautifulSoup
import re
import csv
import time
import pymongo

# 建立连接
client = pymongo.MongoClient('localhost',27017)
# 在mongo中新建名为weather的数据库
book_weather = client['weather']
# 在weather库中新建名为sheet_weather_3的表
sheet_weather = book_weather['sheet_weather_3']

csv_file = csv.reader(open('china-city-list.csv','r',encoding='UTF-8'))
print(csv_file)
data1=list(csv_file)
# date1 = data1.split("\r")
for i in range(3):
    data1.remove(data1[0])

for item in data1[:10]:
    print(item[0:11])
    url = 'https://free-api.heweather.net/s6/weather/now?location=' + item[0] + '&key=756d9a91c4f74734847eab104367c984'
    print(url)
    strhtml = requests.get(url)
    strhtml.encoding='utf8'
    time.sleep(1)
    dic = strhtml.json()
    # print(strhtml.text)
    sheet_weather.insert_one(dic)
  • 写回答

4条回答 默认 最新

  • xiaox 2019-06-22 03:42
    关注

    我最近也遇到过这个问题。
    查看一下你mongo plugin插件的版本号,如果是v0.12.0的话就更新一下到v0.13.1。
    1.先去这个地址https://github.com/dboissier/mongo4idea/files/3300294/mongo4idea.zip下载
    2.然后手动安装
    图片说明

    评论

报告相同问题?