Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This feature was added to Meteor Feb 2016 #32

Open
malhal opened this issue Jun 21, 2016 · 12 comments
Open

This feature was added to Meteor Feb 2016 #32

malhal opened this issue Jun 21, 2016 · 12 comments

Comments

@malhal
Copy link

malhal commented Jun 21, 2016

As of Feb 2016 it is now possible to look up an existing collection, finally!!!

meteor/meteor#5845 (initial attempt)
meteor/meteor#6160 (fix)

Works like this:

Meteor.connection._stores['tasks']._getCollection()

@dburles
Copy link
Collaborator

dburles commented Jun 21, 2016

Hey @malhal thanks for letting me know, strange that no one mentioned it to me earlier

@malhal
Copy link
Author

malhal commented Jun 22, 2016

So now we know they added it as a private API so that you could make use of it in your public API...will you be using it? 😉

@dburles
Copy link
Collaborator

dburles commented Jun 22, 2016

Yep, I'll try to update it sometime this week, though it looks like it won't be backwards compatible.

@malhal
Copy link
Author

malhal commented Jun 22, 2016

Maybe there is a way to implement it differently depending on Meteor's version number?

@dburles
Copy link
Collaborator

dburles commented Jun 22, 2016

api.versionsFrom should take care of that. I'll also publish this current version as 1.0 (I should have done that a while back) then I'll release the newer one as 2.0.

@malhal
Copy link
Author

malhal commented Jun 22, 2016

Nice! By the way I should mention so far I've only used this on the client so not sure about the server.

Update: doesn't appear to work on the server:

TypeError: Cannot read property '_stores' of undefined

Hmm maybe there is more to this than we thought.

@dburles
Copy link
Collaborator

dburles commented Jun 23, 2016

Hmm, would you mind finding out if that's the case back over on the PR?

@fakenickels
Copy link

fakenickels commented Aug 13, 2016

For the server you can get them like:

Package['mongo].MongoInternals.defaultRemoteCollectionDriver().open('colName')

@matteodem
Copy link
Contributor

matteodem commented Nov 8, 2016

as in with import / export:

import { MongoInternals } from 'meteor/mongo'

MongoInternals.defaultRemoteCollectionDriver().open('colName')

@thearabbit
Copy link

Good, Now I found it 💯

@dburles
Copy link
Collaborator

dburles commented Feb 14, 2022

@StorytellerCZ I vaguely remember looking into this, granted it was over 5 years ago. I recall though that it wasn't ideal as there was no way to get collections across different connections, unlike the way this package currently works. Though there still might be a potential enhancement here.

@StorytellerCZ
Copy link
Member

That is my conclusion as well. I will look into this in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

6 participants