Meteor-CollectionFS
Meteor-CollectionFS copied to clipboard
Remote Collection with DDP.connect
Would be awesome to be able to do a remote collection on FS.Collection just like one can on the Meteor.Collection with DDP.connect
Something like this would be amazing, and still be able to do uploads to s3, the filesystem and all that.
RemoteServer = DDP.connect('http://localhost:4000');
Files = new FS.Collection('files', {
connection: RemoteServer
});
I think we'd have to pass the options arg to all of the collections that are created, or at least to the filerecord collection.
@raix, thoughts?
Hmm, it should work, but you have to use accounts on a shared db It looks like connection is missing in https://github.com/CollectionFS/Meteor-CollectionFS/blob/master/packages/collection/common.js#L100
I just guessing here, but I noticed somewhere in FS.HTTP that it had an option for which URL one uploads to, that might have to be modified to work with a remote collection?
+1, need this. It seems like with s3, if you copy the configuration to the other application, it will be able to upload it to your remote application, but with tons of errors
+1 on this. Really need one ^_^
Hello @aldeed !
I want to use FS.Collection on remote application(mobile). Is it possible?
Server is started on http://server.com:3000
On the server image collection:
var imageStore = new FS.Store.S3('image', {...});
Images = new FS.Collection('images', { stores: [imageStore] });
Publish data:
Meteor.publish('images', function() { return Images.find(); });
And all images data stores on server in Mongodb cfs.images.filerecord
collection.
Remote application is started on http://remote.com:3010
I want to subscribe to Images
collection on remote application.
Here is my code on remote app:
if(Meteor.isServer) {
var remote = DDP.connect('http://server.com:3000');
-- connect to server
Images = new FS.Collection('images', {connection: remote});
-- define collection
remote.subscribe('images');
-- subscribe to collection
Meteor.publish('images', function() { return Images.find(); });
}
if(Meteor.isClient) {
Images = new FS.Collection('images');
-- define collection
Meteor.subscribe('images');
-- subscribe to collection
}
This code is not working.
If I use FS.Collection it rise error: You must specify at least one store.
If I use standart Mongo.Collection it returns nothing.
Can you give advice how to subscribe to remote images?
@achirkof Hi, have you found solution to solve this problem? I don't know what to do here. I have same problem that you wrote above.
@vipMura Hi! No, I haven't. Generally I have desided to make native mobile app and exchange data between web and mobile using REST Api.
Has anyone found a solution to this problem? If yes, please tell or suggest some alternate way to achieve this. I want to build a Mobile App which can connect to different DDP connections