Meteor 如何在图像、fs.files和fs.chunks中插入服务器端文件-GridFS(Ostrio/files)

Meteor 如何在图像、fs.files和fs.chunks中插入服务器端文件-GridFS(Ostrio/files),meteor,gridfs,gridfs-stream,Meteor,Gridfs,Gridfs Stream,我在服务器端使用Ostrio/files,也称为meteor文件(来自VeliovGroup或keenethics),将文件插入db.images、db.fs.files和db.fs.chunks。我的代码只在db.images中插入记录,而在fs.files和fs.chunk中不插入记录。我的代码如下: Images.write(this.bodyParams.file{ 文件名:'SignUpTermsAndConditions_'+this.bodyParams.name, fielId

我在服务器端使用Ostrio/files,也称为meteor文件(来自VeliovGroup或keenethics),将文件插入db.images、db.fs.files和db.fs.chunks。我的代码只在db.images中插入记录,而在fs.files和fs.chunk中不插入记录。我的代码如下:

Images.write(this.bodyParams.file{
文件名:'SignUpTermsAndConditions_'+this.bodyParams.name,
fielId:'abc123myId',//可选
键入:“application/vnd.oasis.opendocument.text”,
meta:{owner:this.userId,createdAt:new Date()}
},函数(错误,fileRef){
如果(错误){
投掷误差;
}否则{
console.log(fileRef.name+'已成功保存到FS.\u id:'+fileRef.\u id);
}

});我找到了问题的答案。我将第四个参数设置为true,即proceedAfterUpload=true,并将记录插入db.fs.files和db.fs.chunks中。这是根据,但有点模糊。以下是经修订的守则:

Images.write(this.bodyParams.file{
文件名:'SignUpTermsAndConditions_'+this.bodyParams.name,
fielId:'abc123myId',//可选
键入:“application/vnd.oasis.opendocument.text”,
meta:{owner:this.userId,createdAt:new Date()}
},函数(错误,fileRef){
如果(错误){
投掷误差;
}否则{
console.log(fileRef.name+'已成功保存到FS.\u id:'+fileRef.\u id);
}
},proceedAfterUpload=true)