【问题标题】:Meteor easy-search nested fields in users collectionMeteor 轻松搜索用户集合中的嵌套字段
【发布时间】:2020-06-07 21:01:28
【问题描述】:

我的用户集合中有嵌套属性,例如:“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;
}

感谢任何帮助,谢谢

【问题讨论】:

标签: mongodb meteor selector


【解决方案1】:

你自己已经回答过了。使用基于字符串的属性来查询嵌套对象:

selector['cast.eyes'] = ...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-20
    • 2018-08-17
    • 2019-07-27
    • 2020-06-15
    • 2020-09-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多