我在用着
MongoDB shell version v4.4.0 和 pymongo 3.10.0版本
当我使用any_db.any_collection.count()或any_db.any_collection.count({})在控制台中显示警告
DeprecationWarning: count is deprecated. Use estimated_document_count or count_documents instead. Please note that $where must be replaced by $expr, $near must be replaced by $geoWithin with $center, and $nearSphere must be replaced by $geoWithin with $centerSphere
print(f'Total Categories = {db.rank_list_category.count({})}')
我的代码:
import pandas as pd
from src.utils import get_full_path
from pymongo import MongoClient
from bson.objectid import ObjectId
client = MongoClient('localhost', 27017)
db = client['techexpert']
print(f'Total Categories = {db["rank_list_category"].count({})}')
输出:
Total Categories = 5
/home/mobin/PycharmProjects/IMDb/src/database/database_service_provider.py:17: DeprecationWarning: count is deprecated. Use estimated_document_count or count_documents instead. Please note that $where must be replaced by $expr, $near must be replaced by $geoWithin with $center, and $nearSphere must be replaced by $geoWithin with $centerSphere
print(f'Total Categories = {db.rank_list_category.count({})}')
 梦里花落0921
梦里花落0921 
					临摹微笑
 
					当年话下
 随时随地看视频慕课网APP
随时随地看视频慕课网APP
相关分类