【发布时间】: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
究竟是什么问题?
谢谢
【问题讨论】:
-
这里可能已经回答了这个问题:stackoverflow.com/questions/39451379/…