meteor-file-collection
meteor-file-collection copied to clipboard
allow replace mongo url on grid
meteor has remoteCollectionDriver method to change mongourl
but call remoteCollectionDriver method doesnt
have to replace grid db driver too
@gfs = new grid(@db, mongodb, @root)
grid server coffe
change this and collection._driver maybe
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?
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