I have problems using matb33:collection-hooks@0.7.6 through sewdn:collection-behaviours@0.2.0 together with for example cfs:tempstore@0.1.3
The issue seems to be cased by the use of Meteor.Collection in the cfs packages, instead of the now preferred Mongo.Collection.
The error message is:
W20150302-16:13:27.006(1)? (STDERR) throw(ex);
W20150302-16:13:27.006(1)? (STDERR) ^
W20150302-16:13:27.050(1)? (STDERR) Error: use "new" to construct a Mongo.Collection
W20150302-16:13:27.050(1)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:29:1)
W20150302-16:13:27.050(1)? (STDERR) at [object Object].ns.Collection (packages/matb33:collection-hooks/collection-hooks.js:190:1)
W20150302-16:13:27.050(1)? (STDERR) at Package (packages/cfs:tempstore/tempStore.js:31:1)
W20150302-16:13:27.050(1)? (STDERR) at /Users/johan/dev/collection-hooks-test/.meteor/local/build/programs/server/packages/cfs_tempstore.js:403:4
W20150302-16:13:27.051(1)? (STDERR) at /Users/johan/dev/collection-hooks-test/.meteor/local/build/programs/server/packages/cfs_tempstore.js:410:3
W20150302-16:13:27.051(1)? (STDERR) at /Users/johan/dev/collection-hooks-test/.meteor/local/build/programs/server/boot.js:205:10
W20150302-16:13:27.051(1)? (STDERR) at Array.forEach (native)
W20150302-16:13:27.051(1)? (STDERR) at Function._.each._.forEach (/Users/johan/.meteor/packages/meteor-tool/.1.0.41.1ocyxen++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20150302-16:13:27.051(1)? (STDERR) at /Users/johan/dev/collection-hooks-test/.meteor/local/build/programs/server/boot.js:116:5
It seems to be something sewdn:collection-behaviours is doing that matters too. This since if I do not include that package - but instead only add matb33:collection-hooks directly - I do not get the error. So perhaps this issue should be reported to that repo, but the thing is that I could avoid the issue by modifying the matb33:collection-hooks code only.
I have managed to avoid the error with two different methods,
1) I made a local copy of the cfs packages that used Meteor.Collection and changed them to use Mongo.Collection and everything was fine.
2) I made a local copy of the matb33:collection-hooks@0.7.10 and edited the code in CollectionHooks.wrapCollection() to handle Meteor.Collections by replacing
var ret = constructor.apply(this, arguments);
with
var ret;
if (ns === Meteor) {
ret = new Mongo.Collection(arguments['0']);
} else {
ret = constructor.apply(this, arguments);
}
Is this change wrong in any way? Or should I make a PR with that change to allow the use of collection-hooks together with collection-behaviours and packages that use Meteor.Colelctions?
I have problems using
matb33:collection-hooks@0.7.6
throughsewdn:collection-behaviours@0.2.0
together with for examplecfs:tempstore@0.1.3
The issue seems to be cased by the use of
Meteor.Collection
in the cfs packages, instead of the now preferredMongo.Collection
.The error message is:
The error can be reproduced like this:
It seems to be something
sewdn:collection-behaviours
is doing that matters too. This since if I do not include that package - but instead only addmatb33:collection-hooks
directly - I do not get the error. So perhaps this issue should be reported to that repo, but the thing is that I could avoid the issue by modifying thematb33:collection-hooks
code only.I have managed to avoid the error with two different methods, 1) I made a local copy of the cfs packages that used
Meteor.Collection
and changed them to useMongo.Collection
and everything was fine. 2) I made a local copy of thematb33:collection-hooks@0.7.10
and edited the code inCollectionHooks.wrapCollection()
to handleMeteor.Collection
s by replacingwith
Is this change wrong in any way? Or should I make a PR with that change to allow the use of collection-hooks together with collection-behaviours and packages that use
Meteor.Colelction
s?