创建一个集合对象

@param string $name
@return \MongoCollection
19315
private static function collection(string $name): \MongoCollection
    {
        // 记录开始时间
        $start = timeLog();

        // 取此集合的配置
        $config = configDefault(null, 'mongo', $name);
        if (!$config) {
            trigger_error('读取Mongo服务器配置失败:' . $name, E_USER_ERROR);
        }

        // 智能识别配置信息
        if (is_array($config)) {
            $server = $config['server'];
            if (isset($config['collection'])) {
                $collection = $config['collection'];
            } else {
                $collection = $name;
            }
        } else {
            $server = $config;
            $collection = $name;
        }

        // 连接指定数据库
        $db = self::client($server);

        // 分解库名
        $arr = explode('/', $server);
        $dbname = end($arr);

        // 记录调试信息
        debug("connect to mongo $name ,persist:" . timeLog($start) . 'ms');

        // 返回集合对象
        try {
            return $db->selectCollection($dbname, $collection);
        } catch (\Exception $e) {
            trigger_error('Mongo集合名称错误:' . $name, E_USER_ERROR);
        }

    }
823369
public CollectionDescriptorDef getCollection(String name)
    {
        CollectionDescriptorDef collDef = null;

        for (Iterator it = _collections.iterator(); it.hasNext(); )
        {
            collDef = (CollectionDescriptorDef)it.next();
            if (collDef.getName().equals(name))
            {
                return collDef;
            }
        }
        return null;
    }
948861
protected function getMongoDocumentData($name)
    {
        if (array_key_exists($name, $this->document)) {
            return $this->document[$name];
        }

        return null;
    }
1282352
public function selectCollection($name) {

        if (!isset($this->collections[$name])) {

            if (!in_array($name, $this->getCollectionNames())) {
                $this->createCollection($name);
            }

            $this->collections[$name] = new Collection($name, $this);
        }

        return $this->collections[$name];
    }
1226717
public function getCollection(string $collectionName): Collection
    {
        $collectionFile = $this->getCollectionFilePath($collectionName);
        $storage = $this->factory->storage($collectionFile, $this->type);
        return $this->factory->collection($storage);
    }
962498
private function getOldAttribute($name)
    {
        if ($this->hasOldAttribute($name)) {
            $collection = $this->getOldAttributes();
            return $collection[$name];
        } else {
            // Error
        }
    }
397511
public function get(string $name)
    {
        if (isset($this->workerClassMap[$name])) {
            return $this->container->get($this->workerClassMap[$name]);
        }
        return $this->container->get($name);
    }
926098
public function collection($name, $options = null)
    {
        if (!isset($this->_collections[$name])) {
            $this->_collections[$name] = new Collection($name, $this->_connector, $options);
        }

        return $this->_collections[$name];
    }
1305316
public function selectCollection($name)
    {
        if ($this->eventManager->hasListeners(Events::preSelectCollection)) {
            $this->eventManager->dispatchEvent(Events::preSelectCollection, new EventArgs($this, $name));
        }

        $collection = $this->doSelectCollection($name);

        if ($this->eventManager->hasListeners(Events::postSelectCollection)) {
            $this->eventManager->dispatchEvent(Events::postSelectCollection, new EventArgs($this, $collection));
        }

        return $collection;
    }
795113
public function fields( $name )
    {
        if( $this->fields instanceof FieldCollection ) {
            $this->fields->field($name); //Sets active field
        }
        return $this->fields; // Is a direct access to the property
    }
688966
public function get($name)
    {
        return isset($this->collection[$name]) ? $this->collection[$name] : null;
    }
1028873
public static function getByName(string $name): SurchargeCollection
    {
        $surcharges = Surcharge::get()->where("name", $name);

        return new SurchargeCollection($surcharges->elements());
    }
180079
public function getCollection($name, $refresh = false)
    {
        if ($refresh || !array_key_exists($name, $this->_collections)) {
            $this->_collections[$name] = $this->selectCollection($name);
        }

        return $this->_collections[$name];
    }
1072401
public function getAll($name)
    {
        $data = array();
        foreach ($this->data as $record) {
            $data[] = $record[$name];
        }
        return $data;
    }
505119
protected function loadCollector($name, array $params = null) {
		$locator = $this->getCollectorsLocator();
		
		try {
			return $locator->get(ucfirst($name), $params);
		} catch (Exception $exception) {
			$this->pushException($exception);
		}
	}
556711
public function get($name)
    {
        if (!isset($this->collectors[$name])) {
            throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
        }

        return $this->collectors[$name];
    }
314448
public static function getSortedSet(string $name): array
    {
        $obj = new RedisSortedSet(self::handle(), $name);
        return $obj->all();
    }