Mongo opens too many connections
问题 I am trying to write a lot of data to MongoDB, in a Java loop. I am getting errors based on the number of connections open. My theory is that since MongoDB is not transactional, lots of connections can be opened simultaneously. However the Java code is also able to loop very fast, after a certain time the number of loop iterations starts overtaking the number of available connections and Mongo hits a wall. My code looks like this. I've seen it recommended to not do m.close() but then you just