Refactored MongoDB connection pool to use weakrefs

This allows connections to be closed when they are not used anymore

Change-Id: I54b0260f92376dd66dfda1ddb9405d6e0971f9d9
Merge "Refactored MongoDB connection pool to use weakrefs"