= MongoDelegate

A DelegateCollection wraps a local collection and remote collection in one object that implements the Collection interface.

This was inspired by things I’ve been told about Goldman Sachs’ proprietary object database. You can point one database at another remote database, and it will function in this manner.

The classic use case is debugging a production problem, or developing while using production data.

Just create a DelegatingDatabase and pass to your application, wherever you would normally supply a database
db = Mongo::DelegatingDatabase.new(:local => Mongo::Connection.new.db(‘db-name’), :remote => Mongo::Connection.new(‘remote ip’).db(‘db-name’))

Later, anywhere collections are retrieved in your app
coll = db.collection(‘some-collection-name’) # This returns an instance of Mongo::DelegatingCollection

== Note on Patches/Pull Requests

== Copyright

Copyright © 2010 Mike Harris. See LICENSE for details.