【问题标题】:Meteor.users collection search with EasySearch使用 EasySearch 进行 Meteor.users 收藏搜索
【发布时间】:2019-03-17 13:23:17
【问题描述】:

我正在尝试使用 EasySearch 包搜索 Meteor.users 集合文档,但奇怪的是没有返回任何用户,我已经实现了对其他一些集合的搜索,它正在工作,但在 Meteor.users 中实现时不起作用,这是我的实现

在 API 中

import { Meteor } from 'meteor/meteor';
import { EasySearch } from 'meteor/easy:search';

export const UsersIndex = new EasySearch.Index({
    collection: Meteor.users,
    fields: ['username', 'createdAt'],
    engine: new EasySearch.MongoDB()
});

在客户端

import { UsersIndex } from './../../api/users';

Tracker.autorun(() => {
    let usersSearch = UsersIndex.search('');
    console.log('Users', usersSearch.fetch());
    console.log('Users Count', usersSearch.count());
});

输出是

Users []
Users Count 0

究竟是什么问题?

谢谢

【问题讨论】:

标签: mongodb meteor


【解决方案1】:

Meteor users 系列很特别。出于安全原因,基本上你不能只搜索它。

它不能像普通集合一样对待。我建议创建另一个表格,如membersvisitors,您可以随意搜索。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-30
    • 1970-01-01
    • 1970-01-01
    • 2015-11-08
    • 2013-10-29
    • 2016-05-24
    • 2011-02-27
    相关资源
    最近更新 更多