If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 0
    marcel-maré-11434  11 years ago

    Thanks for this slice!

    One of the reasons of using MongoDB would be to make use of its (non-SQL) query facilities. Using DAL puts a SQL-esque layer on top of MongoDB, which is useful for auth or forms. But if I additionally want to use MongoDB specific functionality (to obtain total world domination of course, what else?), how would one use the DAL connection to do this? How can one get a connection to the Mongo database from the DAL connection pool?

    replies (1)
    • spametki 11 years ago

      Hi. You can avoid using DAL commands by using the instance connection this way:

      >>> mycon = db._adapter.connection

      where mycon is a pymongo.database.Database instance

      Or the equivalent code for using the Python driver directly

Commented on:

Seemingly there is no reason for these extraordinary intergalactical upsets (Ha Ha Ha Ha Ha Ha Ha)

Hosting graciously provided by:
Python Anywhere