I'm developing a Restful service application that uses MongoDb and I need that service to change the connected mongo database based on a parameter. I expect to need a very large number of databases. Maybe thousands.. I tried to use Mongoose but it allows only one connection. What is the best way to approach this problem?
OK, it's reasonable to organize by site in multiple databases rather than by object type in multiple collections, I suppose. Drivers should be able to handle multiple databases just by making multiple connection/client objects, or by working through one connection but talking to multiple databases. Mongoose doesn't talk to more than one database with one connection, but you can create multiple connections. See the "Multiple connections" section in the docs. Also, if you have squillions of databases, read over the namespace size limits