C # / MongoDB: How to keep the connection alive?

I am writing a C # application that accesses a remote MongoDB. How can I continue to save the connection when querying the database? Should I implement some kind of open / close mechanism? Or would it be better to connect once and have a timeout? I am using the official MongoDB / C # driver.

+4
source share
1 answer

Under the hood, the MongoDB C # driver supports a connection pool, which is pretty typical of .NET. The pool works by maintaining multiple open connections for you. When you need a connection, the pool will give you an existing connection (if available).

, , - - , . , , , , .

+4

All Articles