Meteor easy-search 用户集合中的嵌套字段
Meteor easy-search nested fields in users collection
我的用户集合中有嵌套属性,例如:"users.cast.eyes"
如何使用易于搜索的选择器面搜索那些?
/*This is not working, because "eyes" is a nested property*/
if (options.search.props.eyes) {
selector.eyes = options.search.props.eyes;
}
/*This is not working, I'm getting a not such property error*/
if (options.search.props.eyes) {
selector.cast.eyes = options.search.props.eyes;
}
感谢任何帮助,谢谢
您已经自己回答了。使用基于字符串 属性 查询嵌套对象:
selector['cast.eyes'] = ...
我的用户集合中有嵌套属性,例如:"users.cast.eyes"
如何使用易于搜索的选择器面搜索那些?
/*This is not working, because "eyes" is a nested property*/
if (options.search.props.eyes) {
selector.eyes = options.search.props.eyes;
}
/*This is not working, I'm getting a not such property error*/
if (options.search.props.eyes) {
selector.cast.eyes = options.search.props.eyes;
}
感谢任何帮助,谢谢
您已经自己回答了。使用基于字符串 属性 查询嵌套对象:
selector['cast.eyes'] = ...