var gfs;
db.once('open', function () {
gfs = new Grid(db.db, mongoose.mongo);
gfs.collection('assets');
});
The problem is that assets is not being reflected in the schema - I've even gone into the gridfs-steam module and hardcode the value i.e.
Grid.prototype.collection = function (name) {
name || (name = this.mongo.GridStore.DEFAULT_ROOT_COLLECTION);
return this._col = this.db.collection("assets.files");
}
and still the name appears as fs.files in the schema. If the collection name is set like above then it will never use this name. To enforce the name you need to do the following;
var target = commonService.getGridFs().createWriteStream({
filename: fileItem.originalname,
mode: 'w',
metadata: metaData,
root: 'assets' // only works when this is specified here
});
Hi,
I have the following code:
The problem is that assets is not being reflected in the schema - I've even gone into the gridfs-steam module and hardcode the value i.e.
and still the name appears as fs.files in the schema. If the collection name is set like above then it will never use this name. To enforce the name you need to do the following;