client = MongoClient('mongodb://rose:123@127.0.0.1:27017')db = client['book'] # 切换到book库table = db['book_data'] # 使用表
book_name = request.POST.get('book_name', None)
table.find({'name': re.compile(book_name)}) # 模糊查询