Meteor-Community-Packages / mongo-collection-instances

🗂 Meteor package allowing Mongo Collection instance lookup by collection name
http://packosphere.com/dburles/mongo-collection-instances
MIT License
73 stars 27 forks source link

Problem with collection Metor.users #13

Open kjm opened 9 years ago

kjm commented 9 years ago

Hi, It's good idea to have such functionality, thx.

There's a problem with collection served automatically - Meteor.users (by Accounts package). After install mongo-collection-instances this one collection is no more instanceof Mongo.collection. This causes that tests like below fails

if (!(options.collection instanceof Mongo.Collection)) { throw new Error('Tabular.Table options must specify collection'); } or console.log(Meteor.users instanceof Mongo.Collection); ->> false console.log( instanceof Mongo.Collection); ->> true

Any tips how to resolve this? :)

Best regards Konrad

dburles commented 9 years ago

Thanks @kjm I believe @rclai is working on a fix for this, see here; https://github.com/ongoworks/meteor-security/issues/8#issuecomment-75242097

dkoo761 commented 9 years ago

Hi @dburles @rclai I'm still have this issue on IE9 & IE10. Works fine on IE11, Chrome, Firefox, etc. Is anyone else experiencing the problem on IE9/10? It's preventing my production app from loading right now so pretty severe :(

rclai commented 9 years ago

What is the error? Is it the same as above?

dkoo761 commented 9 years ago

@rclai Yes, it's throwing the error here:

if (!(options.collection instanceof Mongo.Collection)) {
    throw new Error('Tabular.Table options must specify collection');
}
rclai commented 9 years ago

Is Tabular.Table a third-party package? Which one is it?

dkoo761 commented 9 years ago

Yes, it's a 3rd party package located here: https://github.com/aldeed/meteor-tabular

rclai commented 9 years ago

What is your list of packages in the .versions file?

dkoo761 commented 9 years ago

accounts-base@1.2.0 accounts-facebook@1.0.4 accounts-oauth@1.1.5 accounts-password@1.1.1 accounts-ui@1.1.5 accounts-ui-unstyled@1.1.7 aldeed:autoform@5.1.2 aldeed:autoform-bs-button-group-input@1.0.2 aldeed:collection2@2.3.3 aldeed:simple-schema@1.3.2 aldeed:tabular@1.2.0 autoupdate@1.2.1 base64@1.0.3 binary-heap@1.0.3 blaze@2.1.2 blaze-tools@1.0.3 boilerplate-generator@1.0.3 callback-hook@1.0.3 check@1.0.5 coffeescript@1.0.6 dburles:mongo-collection-instances@0.3.3 ddp@1.1.0 deps@1.0.7 ejson@1.0.6 email@1.0.6 facebook@1.2.0 fastclick@1.0.3 geojson-utils@1.0.3 goltfisch:braintree-client@0.1.0 goltfisch:braintree-server@0.1.0 handlebars@1.0.3 html-tools@1.0.4 htmljs@1.0.4 http@1.1.0 id-map@1.0.3 infinitedg:winston@0.7.3 iron:controller@1.0.7 iron:core@1.0.7 iron:dynamic-template@1.0.7 iron:layout@1.0.7 iron:location@1.0.7 iron:middleware-stack@1.0.7 iron:router@1.0.7 iron:url@1.0.7 jeremy:autoform-selectize@0.1.0 jeremy:selectize@0.12.1 joshowens:accounts-entry@1.0.3 joshowens:simple-form@0.2.2 jquery@1.11.3_2 json@1.0.3 lai:collection-extensions@0.1.3 launch-screen@1.0.2 less@1.0.14 livedata@1.0.13 localstorage@1.0.3 logging@1.0.7 meteor@1.1.6 meteor-platform@1.2.2 meteorhacks:async@1.0.0 minifiers@1.1.5 minimongo@1.0.8 mobile-status-bar@1.0.3 momentjs:moment@2.8.4 mongo@1.1.0 mrt:just-i18n@0.3.0 mrt:moment@2.8.1 mrt:moment-timezone@0.2.1 mrt:underscore-string-latest@2.3.3 natestrauser:font-awesome@4.3.0 npm-bcrypt@0.7.8_2 oauth@1.1.4 oauth2@1.1.3 observe-sequence@1.0.6 ordered-dict@1.0.3 peerlibrary:aws-sdk@2.1.17_1 peerlibrary:blocking@0.5.2 percolate:synced-cron@1.2.0 percolatestudio:percolatestudio-migrations@0.7.2 random@1.0.3 reactive-dict@1.1.0 reactive-var@1.0.5 reload@1.1.3 retry@1.0.3 routepolicy@1.0.5 schnie:uploader@2.0.3 service-configuration@1.0.4 session@1.1.0 sha@1.0.3 softwarerero:accounts-t9n@1.0.9 spacebars@1.0.6 spacebars-compiler@1.0.6 srp@1.0.3 standard-app-packages@1.0.5 templating@1.1.1 timmyg13:mandrill@0.0.6 tmeasday:publish-counts@0.3.9 tracker@1.0.7 ui@1.0.6 underscore@1.0.3 url@1.0.4 webapp@1.2.0 webapp-hashing@1.0.3

dkoo761 commented 9 years ago

But I can reproduce it on a vanilla installation of Meteor with only the following in .meteor/packages:

dburles:mongo-collection-instances meteor-platform

dkoo761 commented 9 years ago

In the above vanilla installation:

if (Meteor.isClient) {
    console.log(Meteor.users instanceof Mongo.Collection); // <----- false for IE 9/10, true for IE 11
}
rclai commented 9 years ago

Ah okay that's good. I can check that out. I'll keep you posted.

rclai commented 9 years ago

@dkoo761 in your app, can you git clone to your local packages folder the ie9-fix branch of collection-extensions and see if it fixes your problem.

rclai commented 9 years ago

Wait, hold your horses, I messed up something.

rclai commented 9 years ago

@dkoo761 okay, try it now.

dkoo761 commented 9 years ago

@rclai sorry for the delayed reply, I implemented a workaround then got busy with some other stuff.

It appears that this actually made it worse. The server won't even start up now as I'm getting the error:

"Error: Tabular.Table options must specify collection" for the Meteor.users collection.

I git cloned as you asked and named the directory collection-extensions-ie9-fix under /packages. I didn't alter my .packages or .versions file. Do I need to?

dkoo761 commented 9 years ago

If I comment out your new CollectionExtensions._reassignCollectionPrototype and replace it with the previous commit's version then the app at least starts up again so it does look like something specific to this last commit.

Perhaps this polyfill will help? https://gist.github.com/WebReflection/5593554

rclai commented 9 years ago

Yeah, I figured it didn't work. I think I tried that polyfill too, but I'm not sure, if you just locally change it to use the polyfill would it work?

dkoo761 commented 9 years ago

I tried using the polyfill locally and that fixed the startup error but no still no luck with IE9/10 as the polyfill function returns before it does anything useful.