- MongoChef
Eaxmple document schema
{
'sha1': '001',
'time': '2014-12-08T04:02:32.329Z',
'content': 'abc bcd'
}
{
'sha1': '002',
'time': '2015-12-08T04:02:32.329Z',
'content': 'bax abc ccd'
}
{
'sha1': '003',
'time': '2016-12-08T04:02:32.329Z',
'content': 'axabcdgsdf'
}
Below code all based on this schema.
import re
rexExp = re.compile('.*' + 'abc' + '.*', re.IGNORECASE) # 匹配除换行符 \n 之外的任何单字符, 0次或多次
res = db.find({'content':rexExp })
for rs in res:
print(rs)