Connection Pooling — MongoDB Technical Interview Questions & Answers

Reusing connections efficiently under load.

Connection Pooling

  • Simple meaning: A pool is a set of already-open connections the driver reuses, so each find does not TCP-handshake from zero.
  • How to use: drivers pool by default. Tune maxPoolSize in the URI if needed. One MongoClient per app.
  • Atlas has connection limits per tier — opening a client per request will hit the cap.
  • Common mistake: connect/close on every API call in Express.
  • Interview tip: “Reuse MongoClient. Pool is default. Watch Atlas connection limits.”

Technical Interview Tip: Do not connect per request.

Code Examples for Connection Pooling

Connection Pooling — working example

// Connection Pooling
db.users.find({ active: true }).sort({ name: 1 }).limit(5)

Connection Pooling: find active users, sort by name, limit 5.

How to Explain Connection Pooling to an Interviewer

How do you pool connections?

Create one MongoClient Driver pools underneath