【问题标题】:Search in meteor using Easy Search Error: MinimongoEngine使用简易搜索错误在流星中搜索:MinimongoEngine
【发布时间】:2018-04-15 18:26:33
【问题描述】:

我目前正在使用本指南来轻松搜索天气。

http://matteodem.github.io/meteor-easy-search/

它会产生如下错误:

TypeError: MinimongoEngine is not a constructor

这就是我实现搜索的方式:

已安装的软件包:

matteodem:easy-search
easy:search
easysearch:components
easysearch:core

客户端/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>

客户端/searchBox.js

// On Client
Template.searchBox.helpers({
  playersIndex: () => PlayersIndex,
})

lib/collection.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()
})

关于如何解决它的一些想法,我是流星的新手,所以任何帮助将不胜感激。如果我做错了什么,请帮忙。

【问题讨论】:

    标签: meteor meteor-blaze meteor-easy-search


    【解决方案1】:

    在 github 示例中使用 code MongoDBEngine 代替 MinimongoEngine

    查看包源,看起来MinimongoEngineMongoDBEngine 都已导出。会不会是它在客户端想要MinimongoEngine 而在服务器上下文中想要MongoDBEngine?该类型错误是否显示在服务器控制台或浏览器控制台中?

    【讨论】:

      【解决方案2】:

      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()
      })
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-03-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多