报错1:
TypeError: 'Collection' object is not callable. If you meant to call the 'insert' method on a 'Collection' object it is failing because no such method exists
报错2:
AttributeError: 'Cursor' object has no attribute 'conut'
上面的报错都是由于新版本的PyMongo中已经废弃了该方法,包括insert、count,在使用方法时通过insert_one、insert_many来表示插入一条数据和多条数据,通过count_estimated_document_count()、count_count_documents({})来表示统计结果的数量和统计需要指定过滤条件后的结果的数量,并且我在使用时不能同时使用find方法,不然会报错。find方法本身就是all的结果,还有一个find_one。
pymongo的一些方法在看崔庆才老师的书的时候就说过3.x的一些版本官方不推荐直接使用了,但是现在一用,4.x版本的直接就已经废弃了