我目前正在使用本指南对天气进行简单的搜索。
http://matteodem.github.io/meteor-easy-search/
它会生成如下所示的错误:
TypeError: MinimongoEngine is not a constructor
这就是我实现搜索的方式:
安装的软件包:
matteodem:easy-search
easy:search
easysearch:components
easysearch:core
client/searchBox.html
<template name="searchBox">
{{> EasySearch.Input index=playersIndex }}
<ul>
{{#EasySearch.Each index=playersIndex }}
<li>Name of the player: {{name}}</li>
{{/EasySearch.Each}}
</ul>
</template>
客户端/搜索框.js
// On Client
Template.searchBox.helpers({
playersIndex: () => PlayersIndex,
})
库/集合.js
import { Index, MinimongoEngine } from 'meteor/easy:search'
// On Client and Server
const Players = new Mongo.Collection('players')
const PlayersIndex = new Index({
collection: Players,
fields: ['name'],
engine: new MinimongoEngine()
})
关于如何解决它的一些想法,我是流星的新手,所以任何帮助将不胜感激。如果我做错了什么,请帮忙。
ar,我不知道你是如何解决或离开的,但我已经解决了,就像使用 EasySearch.MongoDB
和导入EasySearch
import { EasySearch } from 'meteor/easy:search'
export const EventsIndex = new EasySearch.Index({
collection: Events,
fields: ['title', 'description'],
engine: new EasySearch.MongoDB()
})
在 github 示例中,使用 MongoDBEngine
代替 MinimongoEngine
。
查看包源,看起来MinimongoEngine
和MongoDBEngine
都已导出。可能是它想要在客户端上MinimongoEngine
并在服务器上下文中MongoDBEngine
吗?该类型错误是否显示在服务器控制台或浏览器控制台中?