Quick and simple question.
I have starting to use Mongoc.jl to implement MongoDB procedure into my Jetelina project.
I found "how to connect" in its manual, but nothing "how to disconnect".
I wonder MongoDB should not cut the connection in each?
Quick and simple question.
I have starting to use Mongoc.jl to implement MongoDB procedure into my Jetelina project.
I found "how to connect" in its manual, but nothing "how to disconnect".
I wonder MongoDB should not cut the connection in each?
2
Answers
To disconnect from a MongoDB instance in Julia, you can use the Mongo package. This package allows you to manage MongoDB connections. When you’re done working with the database, you should explicitly close the connection to free up resources.
No worries, the package does all that housekeeping for you.
The following code is from https://github.com/felipenoris/Mongoc.jl/blob/100b732c53d6ce50417dc93c86218c7f92629ed0/src/types.jl:
The Mongoc.jl package’s Client struct represents a database connection. The finalizer (see https://docs.julialang.org/en/v1/base/base/#Base.finalizer) makes sure that when the client goes out of scope (or at the end of your program, if client is a global) the handle is closed.