pymongo 模糊查找是通过正则来实现的,正则有两种可选方案
-
使用 Python 标准库中的
re
模块 -
使用 pymongo 中的
$regex
方法data = self.collection.find({'catch_time': re.compile(start_date)}) data = self.collection.find({'catch_time': {'$regex': catch_date}})
pymongo 模糊查找是通过正则来实现的,正则有两种可选方案
使用 Python 标准库中的 re
模块
使用 pymongo 中的 $regex
方法
data = self.collection.find({'catch_time': re.compile(start_date)})
data = self.collection.find({'catch_time': {'$regex': catch_date}})