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

allow replace mongo url on grid #169

Open
crapthings opened this issue Oct 23, 2017 · 3 comments
Open

allow replace mongo url on grid #169

crapthings opened this issue Oct 23, 2017 · 3 comments
Labels

Comments

@crapthings
Copy link
Contributor

meteor has remoteCollectionDriver method to change mongourl

but call remoteCollectionDriver method doesnt

have to replace grid db driver too

@crapthings
Copy link
Contributor Author

     @gfs = new grid(@db, mongodb, @root)

grid server coffe

change this and collection._driver maybe

Repository owner deleted a comment from crapthings Oct 23, 2017
@vsivsi
Copy link
Owner

vsivsi commented Oct 23, 2017

Hi, I'm not really understanding exactly what you are proposing or what problem it will solve. Can you please explain in a bit more detail what this is about?

@crapthings
Copy link
Contributor Author

crapthings commented Oct 24, 2017

oh sorry about my english, i was on my phone, let me try to explain.

a meteor collection can change mongourl by using MongoInternals.RemoteCollectionDriver

_driver = new MongoInternals.RemoteCollectionDriver(MONGO_URL)
Docs = new Mongo.Collection('docs', { _driver })

and we can even change mongourl dynamically by reassign collection._driver

Docs._driver = new MongoInternals.RemoteCollectionDriver(NEW_MONGO_URL)

but with file collection, changing collection._driver seems not working.

maybe we can add a method to reassign @gfs = new grid(@db, mongodb, @root)

https://github.com/vsivsi/meteor-file-collection/blob/master/src/gridFS_server.coffee#L48

i think we can

const Docs = new FileCollection('docs')
const _driver = new MongoInternals.RemoteCollectionDriver(MONGO_URL)

a method that change both mongourl

Docs._driver = _driver
const gfs = new Grid(_driver.mongo.db, ...)

https://github.com/meteor/meteor/blob/devel/packages/mongo/remote_collection_driver.js

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

No branches or pull requests

2 participants