<?php
set_include_path(BASE_DIR."/MongoDB");spl_autoload_register();
include("MongoDB/functions.php");
class MongoGrid{ private $bucket; function __construct($dbname = "TEST") { $this->bucket = new \MongoDB\GridFS\Bucket(new \MongoDB\Driver\Manager("mongodb://localhost:27017"), $dbname); } public function find(array $args){ return $this->bucket->find($args); }
function downloadToFile(array $args) { $handle = fopen($args['destination'], 'w+'); $this->bucket->downloadToStreamByName($args['filename'], $handle); fclose($handle); }
}
$grid = new MongoGrid("GridTest");
$grid->downloadToFile(['filename' => 'file.txt', 'destination' => 'file2.txt']);
$grid->find(['filename' => 'file.txt']);
?>--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/76d63f3e-803b-4a22-949a-13a67690446f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.