Index: mongodb.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mongodb/mongodb.module,v
retrieving revision 1.13
diff -u -p -r1.13 mongodb.module
--- mongodb.module	9 Apr 2010 21:03:45 -0000	1.13
+++ mongodb.module	3 May 2010 20:39:34 -0000
@@ -41,10 +41,15 @@ function mongodb($alias = 'default') {
  */
 function mongodb_collection($collection_name) {
   $args = func_get_args();
-  // Avoid something. collection names if NULLs are passed in.
+  if (count($args) == 3) {
+    $alias = array_pop($args);
+  }
   $collection_name = implode('.', array_filter($args));
-  $collections = variable_get('mongodb_collections', array());
-  $alias = isset($collections[$collection_name]) ? $collections[$collection_name] : 'default';
+  if (!isset($aliases)) {
+    // Avoid something. collection names if NULLs are passed in.
+    $collections = variable_get('mongodb_collections', array());
+    $alias = isset($collections[$collection_name]) ? $collections[$collection_name] : 'default';
+  }
   // Prefix the collection name for simpletest. It will be in the same DB as the
   // non-prefixed version so it's enough to prefix after choosing the mongodb
   // object.
