Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1614

Using GridFS (Legacy) with multiple MongoClients throws Exception

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.11, 2.2.3
    • Component/s: GridFS
    • None

      If I have a main MongoClient that contains files I want to move from one server to another MongoClient (different connectionstring)

      I get "InvalidOperationException: A nested call to RequestStart was made that is not compatible with the existing request."

      Example code to reproduce the problem:

      var guiDb = new MongoClient("mongodb://server1:27017/GridFSTest").GetServer().GetDatabase("GridFSTest");
      var fs = guiDb.GetGridFS(new MongoGridFSSettings() { Root = "TestArea" });
      var allFiles = fs.FindAll().ToList();
      
      var server = new MongoClient("mongodb://server2:27017/GridFSTestTracker").GetServer().GetDatabase("GridFSTest");
      
      var gridfs = server.GetGridFS(new MongoGridFSSettings()
      {
      	Root = "TestArea"
      });
      
      foreach (var file in allFiles)
      {
      	gridfs.Upload(file.OpenRead(), file.Name, new MongoGridFSCreateOptions { Id = file.Id, ContentType = file.ContentType, UploadDate = DateTime.Now, Metadata = file.Metadata }); // This row throws the exception
      }
      

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            chga Chris GĂ„rdenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: