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

Using GridFS (Legacy) with multiple MongoClients throws Exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Won't Fix
    • 1.11, 2.2.3
    • None
    • GridFS
    • None

    Description

      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
      }
      

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            chga Chris GÃ¥rdenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: