sheila.ar
sheila.ar

Reputation: 57

Search in meteor using Easy Search Error: MinimongoEngine

I am currently using this guide to perform an easy search on weather.

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

It generates an error like the following:

TypeError: MinimongoEngine is not a constructor

This is how I am implementing the search:

Packages installed:

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>

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

Some idea of how to solve it, I’m new to meteor, so any help would be appreciated. If I’m doing something wrong, please help.

Upvotes: 1

Views: 139

Answers (2)

fool-dev
fool-dev

Reputation: 7777

ar, I don't know how you have solved or left that but I have solved as like using EasySearch.MongoDB & importing EasySearch

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

export const EventsIndex = new EasySearch.Index({
   collection: Events,
   fields: ['title', 'description'],
   engine: new EasySearch.MongoDB()
})

Upvotes: 1

Michel Floyd
Michel Floyd

Reputation: 20227

In the github example code MongoDBEngine is used instead of MinimongoEngine.

Looking at the package source it looks like both MinimongoEngine and MongoDBEngine are exported. Could it be that it wants MinimongoEngine on the client and MongoDBEngine in the server context? Is that type error showing up in the server console or in your browser console?

Upvotes: 0

Related Questions