array('$gt' => 0, '$lt' < REQUEST_TIME), ); foreach (array_keys($aliases) as $alias) { // Call mongodb()->selectConnection() directly to avoid prefixing and DB // mapping tricks mongodb_collection() plays, $db = mongodb($alias); $collection = $db->selectCollection('system.namespaces'); $n = strlen($db) + 1; // We won't need to check for system collections because those start with // system. and we search for queue. $find = array('name' => new MongoRegex('/^' . $db .'\.queue\./')); $queues = $collection->find($find); foreach ($queues as $collection_data) { $collection_name = $collection_data['name']; // According to the PECL mongodb source $ means an index. Also check for // a valid collection name. if (strpos($collection_name, '$') === FALSE && substr($collection_name, 0, $n) == "$db.") { // Split off the name of the database. $db->selectCollection(substr($collection_data['name'], $n)) ->update($update_query, array('$set' => array('expire' => 0))); } } } }