コード例 #1
0
 public function testDirectMatch()
 {
     $connection = $this->getConnection();
     $query = new Query();
     $rows = $query->from('fs')->where(['file_index' => 5])->all($connection);
     $this->assertEquals(1, count($rows));
     /* @var $file \MongoGridFSFile */
     $file = $rows[0];
     $this->assertEquals('name5', $file['filename']);
 }
コード例 #2
0
 public function get($user_id)
 {
     $query = new Query();
     $row = $query->from('photo_profile')->where(['userId' => $user_id])->one($this->db);
     return ['contentType' => $row['contentType'], 'byte' => $row['file']->getBytes()];
 }