Meteor-files: Custom ddp connenction: insert ok, find.fetch always return empty array

Created on 29 Jul 2017  路  6Comments  路  Source: veliovgroup/Meteor-Files

I'm using 1.8.1
Meteor 1.51

Problem on client (Android, Cordova)
Default mobile server (A) for cordova app uses only for hot code push of new versions of App

I have another server (B), which stores files in FileCollection

On mobile App, after setting custom dpp connection in FileCollection Constructor (to server B) - I got this issue:
I can upload files to server (B) via this object ( so, insert method working well)
But I always recieve empty cursor if I try to find some files (On server publishing working well - as I recieve files in my simple Client (not Cordova, and uses default Meteor connection)

I've tryed many ways but still not solved my issue

Where to dig?

help wanted question

Most helpful comment

It works!

Images = new FilesCollection({
  collection: new Mongo.Collection('Images', {
    connection: server_connection.get()
  }),
  ddp: server_connection.get()
});

I've tryed to pass collection object with connection parameter, but not passed ddp to FilesCollection - it not worked

小锌邪褋懈斜芯!)

All 6 comments

Hello @Zentelechia ,

Take a look on config.ddp at FilesCollection Constructor.

My guess you should use different connection for Cordova app and Website.
Let me know if it helped.

Hello @dr-dimitru,

Thanks for the fast reply!

In my issue I use different connections :
It's for Cordova:

Images = new FilesCollection({
            collectionName: 'Images',
            ddp: server_connection.get()
        });

server_connection - is a reactive var, which stores DDP.connect answer. At point where I create Images, server_connection is already exists and connection is established

It's for Website

Images = new FilesCollection({
    collectionName: 'Images'
});

Oh, okay...
I think you also should pass collection instead of collectionName.

And collection should be created on custom DDP connection, see docs:

Images = new FilesCollection({
  collection: new Mongo.Collection('Images', {
    connection: server_connection.get()
  }),
  ddp: server_connection.get()
});

And one more thing.... You have mentioned publish but not subscribe, are you subscribing for data?

It works!

Images = new FilesCollection({
  collection: new Mongo.Collection('Images', {
    connection: server_connection.get()
  }),
  ddp: server_connection.get()
});

I've tryed to pass collection object with connection parameter, but not passed ddp to FilesCollection - it not worked

小锌邪褋懈斜芯!)

@Zentelechia hoooray! I'm glad it's solved so quickly.

Please, support this project by:

Was this page helpful?
0 / 5 - 0 ratings