Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1232

downloadStream result "nil"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.0.4
    • Component/s: GridFS
    • Labels:
      None

      Unable to find source-code formatter for language: golang. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      var dodata []byte
      data := []byte("abc")
      uploadStream, err := buck.OpenUploadStream(
      "test.txt",
      )
      if err != nil {
      log.Println(err)
      log.Fatalln("Error opening uploadStream")
      }
      defer uploadStream.Close()
      fileSize, err := uploadStream.Write(data)
      if err != nil {
      log.Fatalln("Error writing uploadStream")
      }
      fileID := uploadStream.FileID
      fmt.Fprintf(w, "Write file to DB was succesful, File size: %d", fileSize)
      fmt.Fprintf(w, ", FileID: %d", fileID)
      
      downloadStream, err := buck.OpenDownloadStreamByName("test.txt")
      if err != nil {
      log.Fatalln(err)
      }
      defer downloadStream.Close()
      downSize, err := downloadStream.Read(dodata)
      if err != nil {
      log.Fatalln(err)
      }
      fmt.Fprintf(w, "Download file from DB was succesful, File size: %d", downSize)
      fmt.Fprintf(w, " Content: %d", dodata)
      

      Hello mongoDB Team
      I have an issue with golang driver and mongoDB. I want to download files from gridfs with downloadStream. Upload wasn't a problem,but if I try to download as you see in the code above, i will get the result like below .But it wasn't successful, because my log.Printf shows me nil.

      Write file to DB was succesful, File size: 3, FileID: [93 82 190 120 106 41 138 138 124 134 194 179]Download file from DB was succesful, File size: 0 Content: []


            Assignee:
            Unassigned Unassigned
            Reporter:
            atak@labmed.de Tufan Atak
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: