mantrajs / meteor-mantra-kickstarter

Kickstart your meteor mantra development
MIT License
184 stars 50 forks source link

1.3 beta 8: Astronomy - Error: The "collection" property has to be an instance of... #7

Open bearcanrun opened 8 years ago

bearcanrun commented 8 years ago

When I run the kickstarter in 1.3 beta 8: I get Error: The "collection" property has to be an instance of the "Mongo.Collection" in the "_color" class

If I pull _colors from collections.js and use directly in colors.js, the error goes away.

import {Mongo} from 'meteor/mongo';

var _colors = new Mongo.Collection('_colors')

const Model = Astro.Class({
  name: '_color',
  collection: _colors,

Of course when I go test it, more things are broken, like method '.find' not found. But I'm not sure if this is an Astronomy or Meteor 1.3 problem.

bright-sea commented 8 years ago

+1 Same at here.

bright-sea commented 8 years ago

This issue existing at 1.3beta 6 & 1.3 beta 7 as well.

A simple fix of this issue is :

change code in /lib/collections.js from

export default {
  Posts: new Mongo.Collection('posts'),
  Comments: new Mongo.Collection('comments')
  ,_colors: new Mongo.Collection('_colors')
};

to

export const Posts = new Mongo.Collection('posts');
export const Comments = new Mongo.Collection('comments');
export const _colors = new Mongo.Collection('_colors');

Everything works fine now.