How does Nodejs MongoDB connection pool work?
insert
is async so the /func1
and /func2
handlers both just queue up 100000 inserts and then return. The connection pool then operates in the background to execute those inserts no more than 5 at a time (1 per connection in the pool).