0
我想使用聚合框架的簡單文本搜索。我正在使用Mongo 3.0.7使用聚合PyMongo文本搜索
數據庫有一個名爲'text'的字段。我試圖從python中檢索mongo的數據。我使用下面的代碼。如果我錯了,請糾正我。
db.tweets.create_index({"text":"text"})
cursor=db.tweets.aggregate(([{"match": {"text": {"search": "cake"}}}]))
for document in cursor:
print(document)
我得到的錯誤:策劃者返回錯誤:究竟需要爲$文本查詢一個文本索引。
謝謝!