I've used ASP.NET and now I'm working on a Sinatra/MongoDB app. With ASP.NET architecture, the connection to the database a given request uses comes from a pool of connections that the ADO.NET manages. The connections are kept alive in the pool between requests so that the cost of building and tearing down the connection isn't paid for each http request.
Is there a similar mechanism in a Sinatra MongoDB app, or will I need to connect/disconnect with each request? If there is a mechanism, what does the code look like?
EDIT1: The following does NOT work. Each HTTP request that the browser sends hits the new.db line, including requests for css, js, jpeg files.
require 'mongo'
include Mongo
db = Mongo::Connection.new.db("MyDb")
class MyApp < Sinatra::Base
get '/' do
etc