Meteor-CollectionFS icon indicating copy to clipboard operation
Meteor-CollectionFS copied to clipboard

Remote Collection with DDP.connect

Open timbrandin opened this issue 10 years ago • 9 comments

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
});

timbrandin avatar Nov 26 '14 12:11 timbrandin

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?

aldeed avatar Nov 26 '14 16:11 aldeed

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

raix avatar Nov 26 '14 18:11 raix

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?

timbrandin avatar Nov 27 '14 07:11 timbrandin

+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

AlexFrazer avatar Sep 16 '15 15:09 AlexFrazer

+1 on this. Really need one ^_^

rizafahmi avatar Oct 11 '15 13:10 rizafahmi

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 avatar Oct 25 '15 13:10 achirkof

@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.

best-4-u avatar Sep 19 '16 12:09 best-4-u

@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.

achirkof avatar Sep 19 '16 14:09 achirkof

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

rkgomekar avatar May 10 '17 09:05 rkgomekar