2016-11-15 65 views

回答

2

是,该指数必须创建

例如(在settings.py)之前:

'mongo_indexes' : {'text': ([('names.keyword', "text")])} 

然后

localhost:5000/api/images?where={"$text": {"$search": "food dog"}} 
+1

中当然你也可以从mongo shell建立索引。然而,对于'mongo_indexes',Eve会在启动时创建索引(如果缺失),这很方便,并确保您始终在正确索引的数据库上运行。 –