python3 failed to insert data into mongodb (check Mongovue, there is no data in the database), but no error was reported when the program ran.
伊谢尔伦
伊谢尔伦 2017-07-03 11:41:06
0
1
1597

code show as below:

#-*-coding:utf8-*-
import pymongo
connection = pymongo.MongoClient()
tdb = connection.jikexueyuan
post_info = tdb.test
jike = {'name':u'极客', 'age':'4', 'skill':'Python'}
gog = {'name':u'天天','age':123, 'skill':'createanything', 'other':u'哈哈'}
godslaver = {'name':u'雨来', 'age':'unknown','other':u'嘻嘻'}
post_info.insert(jike)

print (u'操作数据库完成!')

After the execution is completed, check Mongovue and the results will be displayed as shown below:


The collection is empty. Is this what is the reason?
But if you use another third-party management tool to view it, you can see the created tables and data:


So the problem is with the Mongovue tool? Please answer, thank you

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
学习ing

Maybe you have already opened MongoVUE when inserting. After the data is inserted, the tree structure list on the left is not refreshed, so the tree structure on the left is still displayed in the state before the insertion. You can try right-clicking the left menu to see if the items are refreshed or reloaded.

In addition, if you click on the tab page before inserting, it is best to close the tab page and reopen it after inserting the data, because the tab may also be in the state before inserting.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template