Hi Sabine, take a look to Voyage, and its class�VOMongoSessionPool.
I think a nice way of dealing with what you ask is using the pool and each time you need to do something with the DB, you do it inside a block to #withDatabase:

myPool withDatabase: [:database| self doSomething ]

you also have #withSession instead of #withDatabase.

btw, I guess we can move the pool class from voyage to mongo since it's decoupled.

Cheers,�



On Thu, Jul 18, 2013 at 7:33 AM, Sabine Kn�fel <sabine.knoefel@gmail.com> wrote:
Hi,

Currently, I create one single Instance of Mongo when starting the Image.

| theRoot �|
theRoot := Mongo default.
theRoot open.

and use it for all requests. In my development environment that works fine.

My question is: is this the right way and will it work for production?
Or is it better to create one Mongo instance for each request (and close it
after the request)?
And, btw: what would happen if I would open many Mongo connections but never
close any?
Or better one Instance per user session?

Sabine

(I posted this in Frameworks forum, possibly better here)



--
View this message in context: http://forum.world.st/MongoDB-open-close-in-production-singleton-or-not-tp4699322.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.




--
Mariano
http://marianopeck.wordpress.com