Skip to content

Conversation

jankapunkt
Copy link
Collaborator

I don't intend to use global namespace, since all my collections are encapsulated and referenced via dburles:mongo-collection-instances.

However, I also do not like workarounds in onRendered template functions. This approach assumes the convention of linking your FilesCollection to it's underlying collection instance.

Example:

Link the FilesCollection instance to the Mongo.Collection instance:

export const Images = FilesCollection({  collectionName: 'Images' });
Images.collection.filesCollection = Images;

Retrieve the FilesCollection as every other collection instance:

const Images = Mongo.Collection.get("images").filesCollection;

The change does not add a dependency to dburles:mongo-collection-instances but only checks if it's functionality (Mongo.Collection.get) exists. If not it falls back to the old mechanism.

@jankapunkt
Copy link
Collaborator Author

Note: I added a feature request to the files package where the FilesCollection would be references by the Mongo.Collection: veliovgroup/Meteor-Files#464

If that feature would be accepted and added, the line

Images.collection.filesCollection = Images;

would not be required to be added manually.

}

this.collection = Meteor.connection._mongo_livedata_collections[this.data.atts.collection];
console.log(this.data);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sry for this, removed all others but that :-/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove it by additional commit, no need to send PR, it will go to this PR

}

this.collection = Meteor.connection._mongo_livedata_collections[this.data.atts.collection];
console.log(this.data);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove it by additional commit, no need to send PR, it will go to this PR

@dr-dimitru dr-dimitru merged commit ac6a073 into veliovgroup:master Jul 30, 2017
dr-dimitru added a commit that referenced this pull request Jul 30, 2017
 - Support for `dburles:mongo-collection-instances`, see #28 , thanks
to @jankapunkt
 - `dburles:mongo-collection-instances` is possible fix for issues like
#19
@dr-dimitru
Copy link
Member

@jankapunkt thank you a lot for contribution. Published as v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants