Get mongo db stream collection

@param StreamName $streamName
@return Collection
555602
private function getCollection(StreamName $streamName): Collection
    {
        $collection = $this->mongoClient->selectCollection($this->dbName, $this->getCollectionName($streamName));

        return $collection;
    }
1093151
public function forbidLiveStream($streamName)
    {
        return $this->createRequest([
            'Action' => 'ForbidLiveStream',
            'DomainName' => $this->domain,
            'AppName' => $this->appName,
            'StreamName' => $streamName,
            'LiveStreamType' => 'publisher',
            'ResumeTime' => gmdate('Y-m-d\TH:i:s\Z', mktime(0, 0, 0, 1, 1, 2099))
        ]);
    }
1282126
public function selectCollection($db_name, $collection_name)
    {
        $db = new Db((String) $db_name, $this);
        $collection = $db->selectCollection($collection_name);

        return $collection;
    }
602434
private function getCollectionItemType($className, $fieldName)
    {
        $serializerMetadata = $this->serializerMetadataFactory->getMetadataForClass($className);
        if ($serializerMetadata === null) {
            return null;
        }
        if (!isset($serializerMetadata->propertyMetadata[$fieldName])) {
            return null;
        }

        $type = $serializerMetadata->propertyMetadata[$fieldName]->type;
        return isset($type['name'], $type['params'][0]['name']) && $type['name'] === 'array' ?
            $type['params'][0]['name'] :
            null;
    }
977999
private function getCollection($type) {
        if ($this->collections[$type] === null) {
            try {
                $this->collections[$type] = $this->getMongoClient()->selectCollection(
                    $this->params['databaseName'],
                    $type
                );
            } catch (MongoException $e) {
                throw new DatabaseException('Could not select collection', 500, $e);
            }
        }

        return $this->collections[$type];
    }
377932
public function getItems()
    {
        if (!is_array($this->items)) {
            $items = array();
            foreach ($this->data['items'] as $streamData) {
                $items[] = new Stream($streamData);
            }
            $this->items = $items;
        }
        return $this->items;
    }
946073
function fetchCollection($class_name = "stdClass")
    {
        /* backward compatibility, you can use object instead of class name */
        if (is_object($class_name)) {
            $class_name = get_class($class_name);
        }

        return $this->fetchAll(DB::FETCH_CLASS, $class_name);
    }
1130788
function(dbOrUri, stream, callback) {
    if (arguments.length === 2) {
      callback = stream;
      stream = undefined;
    }
    if (!stream) {
      stream = process.stdout;
    }
    var db;
    var out = stream;
    var endOfCollection = crypto.pseudoRandomBytes(8).toString('base64');
    write({
      type: 'mongo-dump-stream',
      version: '2',
      endOfCollection: endOfCollection
    });
    return async.series({
      connect: function(callback) {
        if (typeof(dbOrUri) !== 'string') {
          // Already a mongodb connection
          db = dbOrUri;
          return setImmediate(callback);
        }
        return mongodb.MongoClient.connect(dbOrUri, function(err, _db) {
          if (err) {
            return callback(err);
          }
          db = _db;
          return callback(null);
        });
      },
      getCollections: function(callback) {
        return db.collections(function(err, _collections) {
          if (err) {
            return callback(err);
          }
          collections = _collections;
          return callback(null);
        });
      },
      dumpCollections: function(callback) {
        return async.eachSeries(collections, function(collection, callback) {
          if (collection.collectionName.match(/^system\./)) {
            return setImmediate(callback);
          }
          return async.series({
            getIndexes: function(callback) {
              return collection.indexInformation({ full: true }, function(err, info) {
                if (err) {
                  return callback(err);
                }
                write({
                  type: 'collection',
                  name: collection.collectionName,
                  indexes: info
                });
                return callback(null);
              });
            },
            getDocuments: function(callback) {
              var cursor = collection.find({}, { raw: true });
              iterate();
              function iterate() {
                return cursor.nextObject(function(err, item) {
                  if (err) {
                    return callback(err);
                  }
                  if (!item) {
                    write({
                      // Ensures we don't confuse this with
                      // a legitimate database object
                      endOfCollection: endOfCollection
                    });
                    return callback(null);
                  }
                  // v2: just a series of actual data documents
                  out.write(item);

                  // If we didn't have the raw BSON document,
                  // we could do this instead, but it would be very slow
                  // write({
                  //   type: 'document',
                  //   document: item
                  // });

                  return setImmediate(iterate);
                });
              }
            },
          }, callback);
        }, callback);
      },
      endDatabase: function(callback) {
        write({
          type: 'endDatabase'
        }, callback);
      }
    }, function(err) {
      if (err) {
        return callback(err);
      }
      return callback(null);
    });
    function write(o, callback) {
      out.write(BSON.serialize(o, false, true, false), callback);
    }
  }
47933
protected function getCollection(): Collection
    {
        $conn = $this->connPool->getConnection();
        $database = $conn->defaultDatabase;
        $collection = $this->schema->collection;

        return $conn->getRawConnection()->$database->$collection;
    }
740084
public function getBulkWriteBuilder(DocumentManager $documentManager, string $collectionName)
    {
        if (!array_key_exists($collectionName, $this->builders)) {
            $this->builders[$collectionName] = new BulkWriteBuilder($documentManager, $collectionName);
        }

        return $this->builders[$collectionName];
    }
469347
public static function createSingleStream($streamName = 'event_stream', $withCausationColumns = false)
    {
        Schema::create($streamName, function (Blueprint $eventStream) use ($streamName, $withCausationColumns) {
            // UUID4 of the event
            $eventStream->char('event_id', 36);
            // Version of the aggregate after event was recorded
            $eventStream->integer('version', false, true);
            // Name of the event
            $eventStream->string('event_name', 100);
            // Event payload
            $eventStream->text('payload');
            // DateTime ISO8601 + microseconds UTC stored as a string e.g. 2016-02-02T11:45:39.000000
            $eventStream->char('created_at', 26);
            // UUID4 of linked aggregate
            $eventStream->char('aggregate_id', 36);
            // Class of the linked aggregate
            $eventStream->string('aggregate_type', 150);

            if ($withCausationColumns) {
                // UUID4 of the command which caused the event
                $eventStream->char('causation_id', 36);
                // Name of the command which caused the event
                $eventStream->string('causation_name', 100);
            }
            $eventStream->primary('event_id');
            // Concurrency check on database level
            $eventStream->unique(['aggregate_id', 'aggregate_type', 'version'], $streamName . '_m_v_uix');
        });
    }
185556
protected function fetchDBRef($typeName, $dbref)
    {
        $typeName = $this->getFullType($typeName);
        if (class_exists($typeName) && MongoDBRef::isRef($dbref)) {
            $collectionName = $typeName::getCollection();
            $collection = $this->_collection->db->$collectionName;
            $data = $this->_cache->fetch("{$collectionName}_{$dbref['$id']}");
            if ($data === null) {
                $data = $this->_collection->getDBRef($dbref);
            }
            if ($data === null) {
                return null;
            }
            return new $typeName($data, $collection, $this->_cache);
        }
        return null;
    }
436011
public function getMongoCollection()
    {
        if (empty($this->collection)) {
            $mongoCollectionClassName = $this->mongoCollectionClassName;
            $this->collection = new $mongoCollectionClassName(
                $this->database->getMongoDB(),
                $this->collectionName
            );
        }

        return $this->collection;
    }
410339
protected function getCollection()
    {
        $collection = [];

        $class = $this->getCollectionClassName();
        if ($class) {
            /** @var Collection $collection */
            $collection = new $class();
            $collection->setModel($this->class);
            $collection->setFormatter($this);
        }

        return $collection;
    }
586575
public function getMetadataFor($entityName, array $parentName = array())
    {
        return $this->hydrateDataObject(
            $this->entityManager->getMetadataFactory()->getMetadataFor($entityName),
            $parentName
        );
    }
413582
public function collection($classname, ...$args)
    {
        $resource = $this->resolve($classname);
        return $resource->collection(...$args);
    }
391197
public function collection($name)
    {
        $builder = new Builder($this, $name, $this->db->selectCollection($name));

        return $builder;
    }