Closed damienrobson closed 7 years ago
Can you show me what code you have inside the ...
?
what kind of a collection is Members
? Is it a MongoDB.Collection?
export const Members = new Mongo.Collection('members');
getting the same error, any solution found?
Can you show me which packages you are using in your project?
fixed it but geeting this error now :x
errorClass details : undefined error : "no-index" errorType : "Meteor.Error" message : "Please provide an index for your component [no-index]" reason : "Please provide an index for your component"
......
fixed :)
what was the "fix"?
I've now fixed this issue - it was to do with the import process of using export const
and then importing with import {Members} ...
. Still might be worth increasing the verbosity of the error, though :)
@matteodem Can you re-open this, please? I'm working on a different project and have the same issue, though I think I understand the cause. Both projects use this package, and particularly, use Meteor.Collection as opposed to Mongo.Collection that you're checking for when creating an index. Is it a simple case of an addition to your check statement to include Meteor.Collection, too?
I've tried to fork it but am hitting brick walls trying to change it myself and see if it solves the issue.
What keeps you from using Mongo.Collection
? is the Meteor.Collection prototype being enhanced by that package?
If that's the case I'd propose that you fork the package and adjust the code, because Meteor.Collection
should not be used anymore.
I tried forking the other package and changing it to Mongo.Collection, but I still get the error when trying to initialise an EasySearch with the collection propert set to the package's collection name.
What version of meteorjs are you using?
It's OK - we've found a workaround. The check only fails in production mode, so we've done the following:
import { EasySearch } from 'meteor/easy:search';
import { Meteor } from 'meteor/meteor';
const Tags = Meteor.tags;
Tags.index = new EasySearch.Index({
collection: new Mongo.Collection(null),
fields: ['name'],
engine: new EasySearch.MongoDB({
sort: () => ({ name: 1 }),
fields: (searchObject, options) => {
if (options.search.props.autosuggest) {
return {
name: 1,
nRefs: 1,
};
}
return {};
},
selector(searchObject, options, aggregation) {
const selector = this.defaultConfiguration().selector(searchObject, options, aggregation);
if (options.search.props.collection) {
selector.collection = options.search.props.collection;
}
if (options.search.props.searchById) {
selector._id = options.search.props.searchById;
}
return selector;
},
}),
});
// Easysearch checks collection is a Mongo.Collection, and this fails in production mode
// (but not in dev mode!). So we set the collection null above and assign here as the check only
// occurs in the constructor. Not great, but gets around the issue...
Tags.index.config.collection = Meteor.tags;
Tags.index.config.name = Meteor.tags._name;
export default Tags;
The following code throws the titular error when I try to run my application:
Any ideas as to how I can resolve this? Full error below:
Or does anyone know how to stop:
exports.check (packages/check/match.js:34:1)