我的用户集合中有嵌套的属性,例如:“ 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;
}
感谢您的帮助,谢谢
答案 0 :(得分:0)
您已经自己回答了。使用基于字符串的属性查询嵌套对象:
selector['cast.eyes'] = ...