c# - GridFS 发生了什么?

标签 c# mongodb mongodb-.net-driver gridfs

我只是移植一个应用程序来使用新的 version 2.0 MongoDB C# driver .我正在努力更换使用 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;
}

最佳答案

显然,GridFS 还不适用于 async 2.0.0 驱动程序,请参阅 CSHARP-1191 .看来他们目前正在研究它。

关于c# - GridFS 发生了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29779739/

相关文章:

c# - LINQ : Get attribute with any namespace but specific name

mongodb - 如何将本地 MongoDB 与 Azure DocumentDB 同步?

python - MongoEngine - 如何关闭游标

c# - 数据库中存储的字符串的编码问题

c# - 从代码隐藏 (C#) 添加 JavaScript 引用

c# - 将代码添加到 C# 获取/设置属性而不需要支持字段?

javascript - 使用 PHP 或 JS 将 BSON 检索到 MongoDB 镜像

c# - 在 C# 中运行 MongoDump/MongoRestore

c# - 如何从 C# Mongodb 强类型驱动程序中的文档加载特定字段

c# - ASP.NET c# 表单验证