What's up with GridFS?

I am just porting my application to use the new 2.0 MongoDB C # driver . I'm trying to replace the parts that use GridFS as I couldn't find any news or documentation regarding GridFS. Since the class is classified as obsolete: how to use it in the latest version?

Sample code that doesn't work:

// 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;



source to share

1 answer

Apparently GridFS is not yet available with async driver 2.0.0, see CSHARP-1191 . It seems they are currently working on it.



All Articles