filter-collections icon indicating copy to clipboard operation
filter-collections copied to clipboard

compatibility with Mongo.Collection (simple-schema)

Open takahser opened this issue 10 years ago • 1 comments

Hello

I'm using the popular simple-schema package for my collections, therefore I declare my collection as instances of Mongo.Collection

e.g.

Items = new Mongo.Collection('items);

Unfortunately the application crashes when trying to publish

// doesn't work, will throw error
Meteor.FilterCollections.publish(Objects, {
  name: 'people-lite'
});

meteor throws the following error:

/Users/moi/.meteor/packages/meteor-tool/.1.1.3.ik16id++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
            throw(ex);
                  ^
TypeError: Cannot call method 'publish' of undefined
  at app/server/publications.js:12:26
  at app/server/publications.js:16:3
  at /Users/moi/myproject/.meteor/local/build/programs/server/boot.js:222:10
  at Array.forEach (native)
  at Function._.each._.forEach (/Users/moi/.meteor/packages/meteor-tool/.1.1.3.ik16id++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
  at /Users/moi/myproject/.meteor/local/build/programs/server/boot.js:117:5

Exited with code: 8
Your application is crashing. Waiting for file change.

is there any way I can still use your package together with simple-form? thank you

takahser avatar Jan 11 '16 01:01 takahser

try the publish without the Meteor.. So instead of

Meteor.FilterCollections.publish(Objects, {
  name: 'people-lite'
});

try

FilterCollections.publish(Objects, {
  name: 'people-lite'
});

jprobst21 avatar Jan 14 '16 05:01 jprobst21