我一直在查看文档,但似乎无法弄清楚如何为buildfire.datastore.search查询正确创建过滤器对象。
我的对象上有一个地址属性,我希望能够输入部分地址并让它返回。以下是我尝试传递给搜索查询的过滤器对象:
search = {filter: {"$json.address": {"$regex": `/${this.state.search}/`}}};
search = {filter: {'$regex': {'$json.address': this.state.search}}};
两者都没有工作。最终目标是:
buildfire.datastore.search(search, 'location', cb);
编辑:
我什至尝试在文档中对正则表达式进行硬编码:
"$or" : [
{"description": {"$regex":"/new /"}}
]
它没有用(我用我知道会显示的字符串替换了'new')。