how about this? (None below means cache forever)
def make_connection():
from pymongo import Connection
connection = Connection('localhost', 27017)
return connection
connection = cache.ram('mongodb',make_connection,None)
On Jul 31, 3:11 am, David Marko <[email protected]> wrote:
> Hi Massimo, can you give ua a hint how to impelement persistent
> connection in web2py for pyMongo? PyMongo requires database connection
> and to use it efficiently the connection has to be persistent and
> shared among requests like a connection pool for database connections
> as DAL has. But how to do it in web2py?
>
> e.g.
> from pymongo import Connection
> connection = Connection('localhost', 27017)
>
> ### how to keep this connection object?
>
> David
>
> On 31 čnc, 09:57, mdipierro <[email protected]> wrote:
>
> > yes. Just set dbio=False in forms and do your own mymongo IO after
> > accepts:
>
> > On Jul 30, 11:18 am, Amit Ambardekar <[email protected]> wrote:
>
> > > I want to use web2py with pymongo.
> > > I don't need ORM or or anything. I just want to connect use pymongo
> > > from Web2Py.
> > > How can I use it inside web2py. I need it for high performance use.
>
> > > Amit