当前位置: 首页>>代码示例>>PHP>>正文


PHP MongoDB::getGridFS方法代码示例

本文整理汇总了PHP中MongoDB::getGridFS方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoDB::getGridFS方法的具体用法?PHP MongoDB::getGridFS怎么用?PHP MongoDB::getGridFS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoDB的用法示例。


在下文中一共展示了MongoDB::getGridFS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetGridFS

 public function testGetGridFS()
 {
     if (preg_match("/5\\.1\\../", phpversion())) {
         $this->markTestSkipped("No implicit __toString in 5.1");
         return;
     }
     $grid = $this->object->getGridFS();
     $this->assertTrue($grid instanceof MongoGridFS);
     $this->assertTrue($grid instanceof MongoCollection);
     $this->assertEquals((string) $grid, "phpunit.fs.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.fs.chunks");
     $grid = $this->object->getGridFS("foo");
     $this->assertEquals((string) $grid, "phpunit.foo.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.foo.chunks");
     $grid = $this->object->getGridFS("foo", "bar");
     $this->assertEquals((string) $grid, "phpunit.foo.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.foo.chunks");
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:18,代码来源:MongoDBTest.php

示例2: gridFS

 public function gridFS($arg1 = NULL, $arg2 = NULL)
 {
     $this->_connected or $this->connect();
     if (!isset($arg1)) {
         $arg1 = isset($this->_config['gridFS']['arg1']) ? $this->_config['gridFS']['arg1'] : 'fs';
     }
     if (!isset($arg2) && isset($this->_config['gridFS']['arg2'])) {
         $arg2 = $this->_config['gridFS']['arg2'];
     }
     return $this->_db->getGridFS($arg1, $arg2);
 }
开发者ID:execrot,项目名称:mongostar,代码行数:11,代码来源:Connection.php

示例3: saveFile

	/**
	 * Saves a file to MongoDB
	 *
	 * @param string $filePath
	 * @param array $oldReference
	 * @return mixed The id of the stored file
	 */
	public function saveFile($filePath, $oldReference = null)
	{
		$id = null;
		if (file_exists($filePath)) {
			if (!empty($oldReference)) {
				$this->db->getGridFS()->remove(array('_id' => $oldReference), true); //remove existing file
			}
			$id = $this->db->getGridFS()->storeFile($filePath);
		} else {
			throw new \InvalidArgumentException("The file $filePath does not exist");
		}
		return $id;
	}
开发者ID:rickyrobinett,项目名称:morph,代码行数:20,代码来源:Storage.php

示例4: doGetGridFS

 /**
  * Return a new GridFS instance.
  *
  * @see Database::getGridFS()
  * @param string $prefix
  * @return GridFS
  */
 protected function doGetGridFS($prefix)
 {
     $mongoGridFS = $this->mongoDB->getGridFS($prefix);
     return new GridFS($this, $mongoGridFS, $this->eventManager);
 }
开发者ID:alcaeus,项目名称:mongodb,代码行数:12,代码来源:Database.php


注:本文中的MongoDB::getGridFS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。