Meteor 通过远程的 GridFS 获取文件 Collection
Meteor get Files via GridFS of a Remote Collection
我正在通过以下模式连接到某个远程 collections:
let remoteDB = new MongoInternals.RemoteCollectionDriver("mongodb://localhost:7071/meteor");
export const RemoteCollection = new Mongo.Collection("remoteCollection", {_driver:remoteDB});
正常 collections。
但是,此远程数据库中也存在 FilesCollection (via ostrio:files)。
FileCollection 构造函数不允许我传递 _driver 选项,所以我想问一下是否有人在打开项目票证之前通过 gridfs 加载了远程文件。
查看 Meteor-Files 的源代码,在 lines 126-130 of server.js
and lines 73-77 of client.js
中添加了 Mongo.Collection
,没有传入任何选项。
您可以做的是将您自己的 RemoteCollection
传递到 FilesCollection
构造函数中,集合将使用您的集合并且它是远程的。
let remoteDB = new MongoInternals.RemoteCollectionDriver("mongodb://localhost:7071/meteor");
export const RemoteCollection = new Mongo.Collection("remoteCollection", {_driver:remoteDB});
export const RemoteFilesCollection = new FilesCollection({
collectionName: "remoteCollection",
collection: RemoteCollection
});
您还需要将 GridFS 集成的所有额外代码添加到 Meteor-Files:https://github.com/VeliovGroup/Meteor-Files/wiki/GridFS-Integration
我正在通过以下模式连接到某个远程 collections:
let remoteDB = new MongoInternals.RemoteCollectionDriver("mongodb://localhost:7071/meteor");
export const RemoteCollection = new Mongo.Collection("remoteCollection", {_driver:remoteDB});
正常 collections。
但是,此远程数据库中也存在 FilesCollection (via ostrio:files)。
FileCollection 构造函数不允许我传递 _driver 选项,所以我想问一下是否有人在打开项目票证之前通过 gridfs 加载了远程文件。
查看 Meteor-Files 的源代码,在 lines 126-130 of server.js
and lines 73-77 of client.js
中添加了 Mongo.Collection
,没有传入任何选项。
您可以做的是将您自己的 RemoteCollection
传递到 FilesCollection
构造函数中,集合将使用您的集合并且它是远程的。
let remoteDB = new MongoInternals.RemoteCollectionDriver("mongodb://localhost:7071/meteor");
export const RemoteCollection = new Mongo.Collection("remoteCollection", {_driver:remoteDB});
export const RemoteFilesCollection = new FilesCollection({
collectionName: "remoteCollection",
collection: RemoteCollection
});
您还需要将 GridFS 集成的所有额外代码添加到 Meteor-Files:https://github.com/VeliovGroup/Meteor-Files/wiki/GridFS-Integration