Commit 780fb6c3 authored by Jeremy Mikola's avatar Jeremy Mikola

Merge pull request #407

parents 680c137c a448b609
......@@ -42,10 +42,12 @@ Methods
/reference/method/MongoDBGridFSBucket-find
/reference/method/MongoDBGridFSBucket-findOne
/reference/method/MongoDBGridFSBucket-getBucketName
/reference/method/MongoDBGridFSBucket-getChunksCollection
/reference/method/MongoDBGridFSBucket-getChunkSizeBytes
/reference/method/MongoDBGridFSBucket-getDatabaseName
/reference/method/MongoDBGridFSBucket-getFileDocumentForStream
/reference/method/MongoDBGridFSBucket-getFileIdForStream
/reference/method/MongoDBGridFSBucket-getFilesCollection
/reference/method/MongoDBGridFSBucket-getReadConcern
/reference/method/MongoDBGridFSBucket-getReadPreference
/reference/method/MongoDBGridFSBucket-getTypeMap
......
==============================================
MongoDB\\GridFS\\Bucket::getChunksCollection()
==============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\GridFS\\Bucket::getChunksCollection()
Returns the chunks collection used by the bucket.
.. code-block:: php
function getChunksCollection(): MongoDB\Collection
Return Values
-------------
A :phpclass:`MongoDB\\Collection` object for the chunks collection.
.. todo: add examples
=============================================
MongoDB\\GridFS\\Bucket::getFilesCollection()
=============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\GridFS\\Bucket::getFilesCollection()
Returns the files collection used by the bucket.
.. code-block:: php
function getFilesCollection(): MongoDB\Collection
Return Values
-------------
A :phpclass:`MongoDB\\Collection` object for the files collection.
.. todo: add examples
......@@ -278,6 +278,16 @@ class Bucket
return $this->bucketName;
}
/**
* Return the chunks collection.
*
* @return Collection
*/
public function getChunksCollection()
{
return $this->collectionWrapper->getChunksCollection();
}
/**
* Return the chunk size in bytes.
*
......@@ -340,6 +350,16 @@ class Bucket
return $file->_id;
}
/**
* Return the files collection.
*
* @return Collection
*/
public function getFilesCollection()
{
return $this->collectionWrapper->getFilesCollection();
}
/**
* Return the read concern for this GridFS bucket.
*
......
......@@ -197,6 +197,16 @@ class CollectionWrapper
return $this->bucketName;
}
/**
* Return the chunks collection.
*
* @return Collection
*/
public function getChunksCollection()
{
return $this->chunksCollection;
}
/**
* Return the database name.
*
......@@ -207,6 +217,16 @@ class CollectionWrapper
return $this->databaseName;
}
/**
* Return the files collection.
*
* @return Collection
*/
public function getFilesCollection()
{
return $this->filesCollection;
}
/**
* Inserts a document into the chunks collection.
*
......
......@@ -363,6 +363,14 @@ class BucketFunctionalTest extends FunctionalTestCase
$this->assertEquals('fs', $this->bucket->getBucketName());
}
public function testGetChunksCollection()
{
$chunksCollection = $this->bucket->getChunksCollection();
$this->assertInstanceOf('MongoDB\Collection', $chunksCollection);
$this->assertEquals('fs.chunks', $chunksCollection->getCollectionName());
}
public function testGetChunkSizeBytesWithCustomValue()
{
$bucket = new Bucket($this->manager, $this->getDatabaseName(), ['chunkSizeBytes' => 8192]);
......@@ -466,6 +474,14 @@ class BucketFunctionalTest extends FunctionalTestCase
$this->bucket->getFileIdForStream($stream);
}
public function testGetFilesCollection()
{
$filesCollection = $this->bucket->getFilesCollection();
$this->assertInstanceOf('MongoDB\Collection', $filesCollection);
$this->assertEquals('fs.files', $filesCollection->getCollectionName());
}
/**
* @dataProvider provideInputDataAndExpectedChunks
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment