Reputation: 1252
In my MongoDB, I have a collection that I created and populated from the server side, called "fs.files" (It's a gridFS collection).
In my meteor app, is there a way to declare a global variable that simply can fetch me information from this database?
I tried
PDFs = new Mongo.Collection("fs.files");
PDFs = new FS.Collection("fs.files", {
stores: [new FS.Store.FileSystem("fsfiles", {path: "./reports"})]
});
Both of them would return an empty array when I do PDFs.find().fetch()
The problem is, I do not want to create a new collection. I simply want to have access to an existing one since I do not create this database from client side.
Upvotes: 2
Views: 1049
Reputation: 20226
Your approach should work. You are likely forgetting to publish this collection on the server and subscribe to it on the client.
server:
Meteor.publish('myPDFs',function(){
return PDFs.find();
});
client:
Meteor.subscribe('myPDFs');
Upvotes: 2