From 57805ea5eda14c2666f02f27802489cbe8cdde7d Mon Sep 17 00:00:00 2001 From: Nora Reidy Date: Fri, 15 Nov 2024 09:44:33 -0500 Subject: [PATCH] DOCSP-45268: Close uploadStream in GridFS code (#405) (cherry picked from commit 71efecefa24963f02198c8834409707db22c6da1) --- source/includes/fundamentals/code-snippets/gridfs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/includes/fundamentals/code-snippets/gridfs.go b/source/includes/fundamentals/code-snippets/gridfs.go index 84fd08d5..45b243c2 100644 --- a/source/includes/fundamentals/code-snippets/gridfs.go +++ b/source/includes/fundamentals/code-snippets/gridfs.go @@ -51,5 +51,10 @@ func main() { panic(err) } fmt.Printf("New file uploaded with %d bytes written", bytes) + + // Calls the Close() method to write file metadata + if err := uploadStream.Close(); err != nil { + panic(err) + } // end OpenUploadStream example }