我只是将一个应用程序移植到使用新的2.0版MongoDB C#驱动程序。我很难更换使用GridFS的部分,因为我找不到任何关于GridFS的新闻或文档。因为它的类被标记为弃用:如何在最新版本中使用它?
失败的示例代码:
// read and store local file in database
using (var stream = new FileStream(filePath, FileMode.Open))
{
// generate unique file name and upload it
var remoteFile = DbCurrent.GridFS.Upload(stream, Guid.NewGuid().ToString());
// save file id
_currentAttachment.FileId = remoteFile.Id.AsObjectId;
}发布于 2015-04-22 08:54:32
显然,异步2.0.0驱动程序还不能使用GridFS,请参阅CSHARP-1191。看来他们目前正在做这个工作。
https://stackoverflow.com/questions/29779739
复制相似问题