creating a different database for each collection in MongoDB 2.2

mongodb

Solution

There's a key limitation to the locking and that is the `local` database. That database includes a the `oplog` collection which is used for replication.

If you're running in production, you should be running with Replica Sets. If you're running with Replica Sets, you need to be aware of the write lock effect on that database.

Breaking out your 10 collections into 10 DBs is useless if they all block waiting for the `oplog`.

Before taking a large step to re-write, please ensure that the `oplog` will not cause issues.

Also, be aware that MongoDB implements DB-level security. If you're using any security features, you are now creating more DBs to secure.

Problem

MongoDB 2.2 has a write lock per database as opposed to a global write lock on the server in previous versions. So would it be ok if i store each collection in a separate database to effectively have a write lock per collection.(This will make it look like MyISAM's table level locking). Is this approach faulty?

Original source